Reusing PC's

John R. Wicks jwicks at
Fri Jan 18 13:26:29 CST 2008

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