PCSetOperators

Barry Smith bsmith at mcs.anl.gov
Thu Nov 16 13:32:37 CST 2006


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

  Use SAME_PRECONDITIONER 

Barry


On Thu, 16 Nov 2006, Matt Funk 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"
> 	
> 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? 
> 3) Do PCSetType and PCSetOperators have the same function?
> 
> 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)?
> 
> 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?
> 
> thanks for all the help
> mat
> 
> 




More information about the petsc-users mailing list