[petsc-users] How to use class function in SNESSetFunction

Matthew Knepley knepley at gmail.com
Mon Nov 14 07:35:09 CST 2011


On Mon, Nov 14, 2011 at 11:35 AM, behzad baghapour <
behzad.baghapour at gmail.com> wrote:

> Dear developers,
>
> In my code, the function "residual" used in SNESSetFunction() for
> calculating Nonlinear function  is a member of a class called "solver".
> When compiling with Petsc, I received the error:
>
> error: argument of type ‘PetscErrorCode (solver::)(_p_SNES*, _p_Vec*,
> _p_Vec*, void*)’ does not match ‘PetscErrorCode (*)(_p_SNES*, _p_Vec*,
> _p_Vec*, void*)’
>
> How can I access that class member function is SNESSetFunction()?
> I need to keep my code structure as before.
>

Make the function static.

   Matt


> Thanks, BB

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111114/8f8b7514/attachment.htm>


More information about the petsc-users mailing list