[petsc-users] pctype comparison

Matthew Knepley knepley at gmail.com
Tue May 7 06:42:09 CDT 2013


On Tue, May 7, 2013 at 4:49 AM, Frederik Treue <frtr at fysik.dtu.dk> wrote:

> Hi,
>
> is there any way of checking which type of PC you are using in the code?
> Ie. I want to do something like:
>

http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscObjectTypeCompare.html

   Matt


> ...
> PCType mytype;
> PC pc;
> if (PhaseOfTheMoon==waxing) {
>         mytype=PCJacobi;
> } else {
>         mytype=PCMG;
> }
> ...
> ierr=PCSetType(pc,mytype);CHKERRQ(ierr);
> if (mytype==PCMG) {
>   ierr=PCMGSetLevels(pc,levels,PETSC_NULL);CHKERRQ(ierr);
>   ...
> }
> ...
>
> But since mytype is apparently a pointer type, this doesn't work.
>
> /Frederik Treue
>
>
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130507/8b6fe0d1/attachment.html>


More information about the petsc-users mailing list