Reusing PC's

Matthew Knepley knepley at gmail.com
Fri Jan 18 13:36:42 CST 2008


On Jan 18, 2008 1:26 PM, John R. Wicks <jwicks at cs.brown.edu> 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?

That sounds like it should work. The set type call should only deal with
implementation data structures, leaving the help objects alone (like the
PC held by the KSP).

  Matt

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




More information about the petsc-users mailing list