> On Apr 25, 2017, at 1:36 PM, Zhang, Hong <[email protected]> wrote: > > PetscBool is indeed an int. So there is nothing wrong. PETSc does not use > bool in order to support C89.
Yes, but in Python using a bool is more natural. For example in Fortran PETSc uses the Fortran logical as the PetscBool Barry > > Hong (Mr.) > >> On Apr 25, 2017, at 11:48 AM, Garth N. Wells <[email protected]> wrote: >> >> I'm seeing some behaviour with bool types in petsc4py that I didn't >> expect. In the Python interface, returned Booleans have type '<class >> 'int'>', where I expected them to have type ' <class 'bool'>'. Below >> program illustrates issue. Seems to be related to bint in cython. Am I >> doing something wrong? >> >> Garth >> >> >> from petsc4py import PETSc >> A = PETSc.Mat() >> A.createAIJ((2, 2)) >> A.setOption(PETSc.Mat.Option.SYMMETRIC, True) >> symm = A.isSymmetricKnown() >> print("Symmetry set:", symm[0] is True) >> print("Symmetry set:", symm[0] == True) >> print("Bool type:", type(symm[0])) >
