PCSetOperators

Matthew Knepley knepley at gmail.com
Thu Nov 16 13:24:50 CST 2006


On 11/16/06, Matt Funk <mafunk at nmsu.edu> wrote:
> Hi,
>
> i had a question regarding PCSetOperators(...):
>
> 1) what is the difference between PCSetOperators and KSPSetOperators since the
> description and the arguments for both functions are the same (i.e.):
>         "Sets the matrix associated with the linear system and a (possibly) different
> one associated with the preconditioner"

KSPSetOperators() calls the PC version.

> Right now, what i do to set my preconditioner is to call:
>         PCSetType(m_pc, PCJACOBI);
> 2) Is this sufficient or do i need to call PCSetOperators?

It should be sufficient.

> 3) Do PCSetType and PCSetOperators have the same function?

No. We allow the later in order to support construction of the PC very early on.

> Right now what i basically do to set up my solver context is to call the
> following functions (in this order):
>         - KSPCreate //create my context
>         - KSPSetOperators //associate my matrix with the context
>         - KSPSetType //set my solver type
>         - PCSetType
>         - KSPSetUp
> It seems to work, but i don't know if it is efficient and preferred way (if
> there is such a thing)?

This seems fine.

> Also, do several successive solves on the same linear system with the same
> preconditioner. So i pass SAME_NONZEROPATTERN as the MatStructure flag to the
> KSPSetOperators call. So do i need to call PCSetOperators and pass it the
> flag as well to reuse the preconditioner?

No.

   Matt

> thanks for all the help
> mat
-- 
"Failure has a thousand explanations. Success doesn't need one" -- Sir
Alec Guiness




More information about the petsc-users mailing list