<div class="gmail_quote">On Wed, Nov 23, 2011 at 00:47, behzad baghapour <span dir="ltr">&lt;<a href="mailto:behzad.baghapour@gmail.com">behzad.baghapour@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":41">As I want to keep my code structure as before applying SNES, I defined a FieldContext and pass my data like element and face values into this context by pointing there addresses of elements and faces of the field like this:<br>

<br>typedef struct {<br>element* e; face* f; flow* flw; }FieldCtx;<br>    <br>FC.e = e;                         <br>    FC.f = f;
<br>    FC.flw = flw;</div></blockquote></div><br><div>This is mesh topology and geometry or are these state variables? If the latter, then you can&#39;t do it this way. You have to evaluate the residual at the state passed into your SNES residual function, not based on whatever is in this other struct.</div>