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

behzad baghapour behzad.baghapour at gmail.com
Mon Nov 14 05:35:59 CST 2011

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.

Thanks, BB.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111114/3da8e301/attachment.htm>

More information about the petsc-users mailing list