<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Mar 20, 2017 at 7:01 PM, Ping He <span dir="ltr"><<a href="mailto:friedenhe@gmail.com" target="_blank">friedenhe@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Matt,<br>
<br>
I know it is an old thread and your solution works well, but I still want to ask if there are any alternative instead of setting the member function "static". The issue is that I need to use multiple member functions (20+) in SNESSetFunction and numerous class variables. So changing all of them to static will need quite a lot of code/structure change. Thanks very much in advance.<br></blockquote><div><br></div><div>1) Make a static member function that you pass in. That is the only way to match the signature.</div><div><br></div><div>2) Pass your object as the user context</div><div><br></div><div>3) Inside your static function, use your object from the context argument to call your member function with the other arguments.</div><div><br></div><div>  Thanks,</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">
Regards,<br>
Ping<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="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>