PCGetType question
Lisandro Dalcin
dalcinl at gmail.com
Fri Feb 8 07:52:46 CST 2008
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
More information about the petsc-users
mailing list