PetscInfoAllow

Issue #25 closed
Thomas Hisch created an issue

Is it possible to call PetscInfoAllow within a python script?

Comments (8)

  1. Thomas Hisch reporter

    The following patch implements the missing InfoAllow wrapping.

    diff --git a/src/PETSc/Sys.pyx b/src/PETSc/Sys.pyx
    index b26c353..4e12085 100644
    --- a/src/PETSc/Sys.pyx
    +++ b/src/PETSc/Sys.pyx
    @@ -166,5 +166,11 @@ cdef class Sys:
         @classmethod
         def popErrorHandler(cls):
             CHKERR( PetscPopErrorHandler() )
    -    
    +
    +    @classmethod
    +    def info_allow(cls, flag):
    +        cdef PetscBool tval = PETSC_FALSE
    +        if flag: tval = PETSC_TRUE
    +        CHKERR( PetscInfoAllow(tval, NULL) )
    +
     # --------------------------------------------------------------------
    diff --git a/src/PETSc/petscsys.pxi b/src/PETSc/petscsys.pxi
    index 9b9e095..6c53fb9 100644
    --- a/src/PETSc/petscsys.pxi
    +++ b/src/PETSc/petscsys.pxi
    @@ -33,6 +33,7 @@ cdef extern from * nogil:
         PetscErrorHandlerFunction PetscIgnoreErrorHandler
         int PetscPushErrorHandler(PetscErrorHandlerFunction,void*)
         int PetscPopErrorHandler()
    +    int PetscInfoAllow(PetscBool, char*)
    
         int PetscErrorMessage(int,char*[],char**)
    

    However, calling PETSc.Sys.info_allow(False) after PETSc.Sys.info_allow(True) seems to have no effect. Any ideas?

  2. Lisandro Dalcin

    Mmm, perhaps using the command line is the only way to activating it? There are some things you can activate only before PetscInitialize() is called.

  3. Lisandro Dalcin

    I would say just email petsc-dev and ask about it. Basically, you want to deactivate -info after it being activated. It seems this is not supported.

  4. Thomas Hisch reporter

    With petsc/slepc 3.6 I get the expected output now. Shall I open a PR? What kind of API do you propose?

  5. Lisandro Dalcin

    Yes, make a PR to maint branch. Just use your diff, but please name the method infoAllow().

  6. Log in to comment