On Wed, Feb 22, 2012 at 08:52, Kuhlemann, Verena <vkuhlem@emory.edu> wrote:
I am not sure that I understand the MatStructure flag in the call of KSPSetOperators
correctly.

If I use KSPSetOperators(ksp, A, P, DIFFERENT_NONZERO_PATTERN) and then
solve two linear systems with the same matrix operators but different rhs is
the preconditioner reassembled in every solve. I.e., if I call
KSPSolve(ksp,b1,x1);
KSPSolve(ksp,b2,x2);

If you don't put anything between these calls, the preconditioner will be reused.
 

And if I use KSPSetOperators(ksp, A, P, SAME_PRECONDITIONER) the preconditioner is 
only setup one time and reused later.

Or is the flag only important if I change the matrix operators in between.

You only need to call KSPSetOperators() when the matrix changes.