Actual source code: zlinesearchshellf.c

      1: #include <petsc/private/ftnimpl.h>
      2: #include <petscsnes.h>

      4: #if defined(PETSC_HAVE_FORTRAN_CAPS)
      5:   #define sneslinesearchshellsetapply_ SNESLINESEARCHSHELLSETAPPLY
      6:   #define sneslinesearchshellgetapply_ SNESLINESEARCHSHELLGETAPPLY
      7: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
      8:   #define sneslinesearchshellsetapply_ sneslinesearchshellsetapply
      9:   #define sneslinesearchshellgetapply_ sneslinesearchshellgetapply
     10: #endif

     12: static PetscErrorCode oursneslinesearchshellfunction(SNESLineSearch linesearch, void *ctx)
     13: {
     14:   PetscFunctionBegin;
     15:   PetscCallFortranVoidFunction((*(void (*)(SNESLineSearch *, void *, PetscErrorCode *))(((PetscObject)linesearch)->fortran_func_pointers[0]))(&linesearch, ctx, &ierr));
     16:   PetscFunctionReturn(PETSC_SUCCESS);
     17: }

     19: PETSC_EXTERN void sneslinesearchshellsetapply_(SNESLineSearch *linesearch, void (*func)(SNESLineSearch *, void *, PetscErrorCode *), void *ctx, PetscErrorCode *ierr)
     20: {
     21:   PetscObjectAllocateFortranPointers(*linesearch, 3);
     22:   ((PetscObject)*linesearch)->fortran_func_pointers[0] = (PetscFortranCallbackFn *)func;

     24:   *ierr = SNESLineSearchShellSetApply(*linesearch, oursneslinesearchshellfunction, ctx);
     25: }

     27: PETSC_EXTERN void sneslinesearchshellgetapply_(SNESLineSearch *linesearch, void *func, void **ctx, PetscErrorCode *ierr)
     28: {
     29:   CHKFORTRANNULLINTEGER(ctx);
     30:   *ierr = SNESLineSearchShellGetApply(*linesearch, NULL, ctx);
     31: }