Dave May <[email protected]> writes:

> On Mon, 4 Mar 2019 at 21:30, Jed Brown <[email protected]> wrote:
>
>> If reusing, would the interface require
>> casting the function pointers to void(*)(void) instead of what is
>> currently type-safe for most function pointers?
>
>
> No. I don't see that casting a function pointer would be required.
> We would have
>
> SNESSetJacobian(SNES snes,Mat Amat,Mat Pmat,PetscErrorCode
> (*J)(SNES,Vec,Mat,Mat,PetscObject),PetscObject ctx)

Oh, the PetscObject would only contain the context, not the function
pointer (at least not publicly).  What does user code look like?

  PetscErrorCode f(..., PetscObject ctx) {
    User user;
    ierr = PetscContainerGetPointer((PetscContainer)ctx,&user);CHKERRQ(ierr);
    ...
  }

Reply via email to