<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Apr 18, 2016 at 9:34 AM, Hoang Giang Bui <span dir="ltr"><<a href="mailto:hgbk2008@gmail.com" target="_blank">hgbk2008@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello<div><br></div><div>Is it possible to combine the SNESSetFunction and SNESSetJacobian into one call, i.e. SNESSetFunctionAndJacobian which takes unique function pointer to compute rhs and Jacobian concurrently? The reason for it is that the finite element code I'm working on contribute to global rhs and stiffness at one call, so to cater for SNES would break the existing interface.</div></div></blockquote><div><br></div><div>The Jacobian and Residual are not always formed together, so you would have to stash your computation in a user context</div><div>and then check that the same X had been passed to both functions. For example, the Residual can be called many times in</div><div>a line search routine.</div><div><br></div><div>   Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Another supporting point for that feature is that for irreversible problem, the rhs (equilirium) and Jacobian shall not be decoupled, since they are not able to return to the past state after proceed.</div></div></blockquote><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class="HOEnZb"><font color="#888888"><div><div><div><div dir="ltr">Giang</div><div dir="ltr"><br></div></div></div>
</div></font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</div></div>