Reusing PC's

Barry Smith bsmith at
Fri Jan 18 13:50:30 CST 2008

   Just do it.


On Jan 18, 2008, at 1:26 PM, John R. Wicks wrote:

> For a given (very large) system of equations, I would like to vary the
> preconditioner and solve method used.  Since constructing the  
> preconditioner
> is somewhat expensive, I would like to be able to reuse the PC and  
> vary the
> KSP method, i.e., the outer loop should vary the PCType and the  
> inner loop
> should vary the KSPType.  Is it possible to reuse KSP contexts and  
> PC's in
> this way?  Ideally, I should only need to call KSPCreate once,  
> outside both
> loops, extract the PC, and then call PCSetType in the outer loop and
> KSPSetType in the inner loop.  How do I make sure that any ancillary  
> data
> structures are properly destroyed/reallocated when I change types?

More information about the petsc-users mailing list