[petsc-users] Calling function from outside of SNES

Jed Brown jedbrown at mcs.anl.gov
Thu Apr 5 07:17:07 CDT 2012


On Thu, Apr 5, 2012 at 05:02, behzad baghapour
<behzad.baghapour at gmail.com>wrote:

> I could solve the problem by shifting the postCheck below the
> SNESSetFromOptions but still have another problem with passing defined
> context:
>
> All my calcualtions are saved into global FieldContext including
> flow-field variables. I passed it to PostCheck. I could apply my desired
> change on the context BUT the results came back to the original values
> (before postCheck function) and therefore my efferts to modify the Newton
> procedure did not achieved.
>
> How should I handle it?
>

You will have to explain more completely what is happening. If you want the
postcheck to modify a context, you have to make sure that it sees the same
context. PETSc NEVER does anything with the context pointers, it just
passes it through to the callbacks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120405/5e41a685/attachment.htm>


More information about the petsc-users mailing list