On 2/8/08, Vijay S. Mahadevan <vijay.m at gmail.com> wrote: > PetscTruth isshell ; > PetscTypeCompare((PetscObject)pc, PCSHELL, &isshell); > PetscPrintf(PETSC_COMM_SELF, " PETSC_IS_SHELL = %D", isshell) ; > Result: The isshell variable is always false even when I set ?pc_type shell > option. Why ?
Did you call PCSetFromOptions (or KSPSetFromOptions) before calling PetscTypeCompare()? If not, the option '-pc_type' will not be used > Method 2: > PCType currpcType ; > ierr = PCGetType(pc, &currpcType) ; > if(currpcType == PCSHELL) > isshell = PETSC_TRUE ; > PetscPrintf(PETSC_COMM_SELF, " PETSC_IS_SHELL = %D", isshell) ; > Result: Again, the isshell variable is always false even when I set ?pc_type > shell option. Also, my currpcType string is a null string. PCType is a 'const char*', so you should never compare that with '==' opertor!!. Again, if you got a null pointer from PCGetType(), my guess is that you forgot to call XXXSetFromOptions, where XXX is PC, or a KSP object containing it, or a SNES cointaing the KSP in turn containing the PC. -- Lisandro Dalc?n --------------- Centro Internacional de M?todos Computacionales en Ingenier?a (CIMEC) Instituto de Desarrollo Tecnol?gico para la Industria Qu?mica (INTEC) Consejo Nacional de Investigaciones Cient?ficas y T?cnicas (CONICET) PTLC - G?emes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594
