<div class="gmail_quote">On Tue, May 8, 2012 at 5:23 AM, Dominik Szczerba <span dir="ltr"><<a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div id=":3q9">Hi, I do set my own KSP to SNES:<br>
<br>
<br>
ierr = SNESCreate(PETSC_COMM_WORLD, &snes); CHKERRQ(ierr);<br>
ierr = SNESSetKSP(snes, ksp); CHKERRQ(ierr);<br>
<br>
I set the ksp solver type, tolerances etc. Then I register<br>
FormFunction using SNESSetFunction, and implement it as;<br>
<br>
<br>
PetscErrorCode FormFunction(SNES snes, Vec x, Vec f, void *ctx)<br>
<br>
Now my question: is "x" in the signature above expected to be the same<br>
as "x" obtained after a linear solve in the KSP object used in SNES<br>
(that I pass inside ctx), or will "x" be generally differently-valued<br>
due to e.g. the line search performed?</div></blockquote></div><br><div>Newton-based SNES solves for snes->vec_sol_update, but evaluates at snes->vec_sol and using another vector inside the line search.</div><div><br>
</div><div>If you are writing code that depends on the Vec being the same, you're doing it wrong.</div>