[petsc-users] pctype comparison

Frederik Treue frtr at fysik.dtu.dk
Tue May 7 04:49:11 CDT 2013


Hi,

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

...
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




More information about the petsc-users mailing list