Actual source code: zblockf90.c

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

  4: #if PetscDefined(HAVE_FORTRAN_CAPS)
  5:   #define isblockgetindices_     ISBLOCKGETINDICES
  6:   #define isblockrestoreindices_ ISBLOCKRESTOREINDICES
  7: #elif !PetscDefined(HAVE_FORTRAN_UNDERSCORE)
  8:   #define isblockgetindices_     isblockgetindices
  9:   #define isblockrestoreindices_ isblockrestoreindices
 10: #endif

 12: PETSC_EXTERN void isblockgetindices_(IS *is, F90Array1d *ptr, int *ierr PETSC_F90_2PTR_PROTO(ptrd))
 13: {
 14:   const PetscInt *fa;
 15:   PetscInt        len;
 16:   *ierr = ISBlockGetIndices(*is, &fa);
 17:   if (*ierr) return;
 18:   *ierr = ISBlockGetLocalSize(*is, &len);
 19:   if (*ierr) return;
 20:   *ierr = F90Array1dCreate((void *)fa, MPIU_INT, 1, len, ptr PETSC_F90_2PTR_PARAM(ptrd));
 21: }
 22: PETSC_EXTERN void isblockrestoreindices_(IS *is, F90Array1d *ptr, int *ierr PETSC_F90_2PTR_PROTO(ptrd))
 23: {
 24:   const PetscInt *fa;
 25:   *ierr = F90Array1dAccess(ptr, MPIU_INT, (void **)&fa PETSC_F90_2PTR_PARAM(ptrd));
 26:   if (*ierr) return;
 27:   *ierr = F90Array1dDestroy(ptr, MPIU_INT PETSC_F90_2PTR_PARAM(ptrd));
 28:   if (*ierr) return;
 29:   *ierr = ISBlockRestoreIndices(*is, &fa);
 30: }