Actual source code: zsnesf90.c

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

      4: #if defined(PETSC_HAVE_FORTRAN_CAPS)
      5:   #define snesgetconvergencehistory_     SNESGETCONVERGENCEHISTORY
      6:   #define snesrestoreconvergencehistory_ SNESRESTORECONVERGENCEHISTORY
      7: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
      8:   #define snesgetconvergencehistory_     snesgetconvergencehistory
      9:   #define snesrestoreconvergencehistory_ snesrestoreconvergencehistory
     10: #endif

     12: PETSC_EXTERN void snesgetconvergencehistory_(SNES *snes, F90Array1d *r, F90Array1d *fits, PetscInt *n, int *ierr PETSC_F90_2PTR_PROTO(ptrd1) PETSC_F90_2PTR_PROTO(ptrd2))
     13: {
     14:   PetscReal *hist;
     15:   PetscInt  *its, N;

     17:   CHKFORTRANNULLINTEGER(n);
     18:   *ierr = SNESGetConvergenceHistory(*snes, &hist, &its, &N);
     19:   if (*ierr) return;
     20:   *ierr = F90Array1dCreate(hist, MPIU_REAL, 1, N, r PETSC_F90_2PTR_PARAM(ptrd1));
     21:   if (*ierr) return;
     22:   *ierr = F90Array1dCreate(its, MPIU_INT, 1, N, fits PETSC_F90_2PTR_PARAM(ptrd2));
     23:   if (n) *n = N;
     24: }

     26: PETSC_EXTERN void snesrestoreconvergencehistory_(SNES *snes, F90Array1d *r, F90Array1d *fits, PetscInt *n, int *ierr PETSC_F90_2PTR_PROTO(ptrd1) PETSC_F90_2PTR_PROTO(ptrd2))
     27: {
     28:   *ierr = F90Array1dDestroy(r, MPIU_SCALAR PETSC_F90_2PTR_PARAM(ptrd1));
     29:   if (*ierr) return;
     30:   *ierr = F90Array1dDestroy(fits, MPIU_SCALAR PETSC_F90_2PTR_PARAM(ptrd2));
     31: }