File: Errhandler.pyx

package info (click to toggle)
paraview 3.14.1-6
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 234,468 kB
  • sloc: cpp: 2,166,013; ansic: 801,575; xml: 58,068; tcl: 49,247; python: 43,091; java: 16,625; fortran: 12,224; sh: 11,722; yacc: 5,688; perl: 3,128; makefile: 2,228; lex: 1,311; lisp: 486; asm: 471; pascal: 228
file content (59 lines) | stat: -rw-r--r-- 1,670 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
cdef class Errhandler:

    """
    Error Handler
    """

    def __cinit__(self):
        self.ob_mpi = MPI_ERRHANDLER_NULL

    def __dealloc__(self):
        if not (self.flags & PyMPI_OWNED): return
        CHKERR( _del_Errhandler(&self.ob_mpi) )

    def __richcmp__(self, other, int op):
        if not isinstance(self,  Errhandler): return NotImplemented
        if not isinstance(other, Errhandler): return NotImplemented
        cdef Errhandler s = self, o = other
        if   op == 2: return (s.ob_mpi == o.ob_mpi)
        elif op == 3: return (s.ob_mpi != o.ob_mpi)
        else: raise TypeError(mpistr("only '==' and '!='"))

    def __nonzero__(self):
        return self.ob_mpi != MPI_ERRHANDLER_NULL

    def Free(self):
        """
        Free an error handler
        """
        CHKERR( MPI_Errhandler_free(&self.ob_mpi) )

    # Fortran Handle
    # --------------

    def py2f(self):
        """
        """
        return MPI_Errhandler_c2f(self.ob_mpi)

    @classmethod
    def f2py(cls, arg):
        """
        """
        cdef Errhandler errhandler = cls()
        errhandler.ob_mpi = MPI_Errhandler_f2c(arg)
        return errhandler



cdef Errhandler __ERRHANDLER_NULL__  = _new_Errhandler(MPI_ERRHANDLER_NULL)
cdef Errhandler __ERRORS_RETURN__    = _new_Errhandler(MPI_ERRORS_RETURN)
cdef Errhandler __ERRORS_ARE_FATAL__ = _new_Errhandler(MPI_ERRORS_ARE_FATAL)


# Predefined errhandler handles
# -----------------------------

ERRHANDLER_NULL  = __ERRHANDLER_NULL__  #: Null error handler
ERRORS_RETURN    = __ERRORS_RETURN__    #: Errors return error handler
ERRORS_ARE_FATAL = __ERRORS_ARE_FATAL__ #: Errors are fatal error handler