1*6dd63270SBarry Smith #include <petscis.h> 2*6dd63270SBarry Smith #include <petsc/private/ftnimpl.h> 3*6dd63270SBarry Smith 4*6dd63270SBarry Smith #if defined(PETSC_HAVE_FORTRAN_CAPS) 5*6dd63270SBarry Smith #define islocaltoglobalmappinggetindices_ ISLOCALTOGLOBALMAPPINGGETINDICES 6*6dd63270SBarry Smith #define islocaltoglobalmappingrestoreindices_ ISLOCALTOGLOBALMAPPINGRESTOREINDICES 7*6dd63270SBarry Smith #define islocaltoglobalmappinggetblockindices_ ISLOCALTOGLOBALMAPPINGGETBLOCKINDICES 8*6dd63270SBarry Smith #define islocaltoglobalmappingrestoreblockindices_ ISLOCALTOGLOBALMAPPINGRESTOREBLOCKINDICES 9*6dd63270SBarry Smith #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) 10*6dd63270SBarry Smith #define islocaltoglobalmappinggetindices_ islocaltoglobalmappinggetindices 11*6dd63270SBarry Smith #define islocaltoglobalmappingrestoreindices_ islocaltoglobalmappingrestoreindices 12*6dd63270SBarry Smith #define islocaltoglobalmappinggetblockindices_ islocaltoglobalmappinggetblockindices 13*6dd63270SBarry Smith #define islocaltoglobalmappingrestoreblockindices_ islocaltoglobalmappingrestoreblockindices 14*6dd63270SBarry Smith #endif 15*6dd63270SBarry Smith 16*6dd63270SBarry Smith PETSC_EXTERN void islocaltoglobalmappinggetindices_(ISLocalToGlobalMapping *da, F90Array1d *indices, int *ierr PETSC_F90_2PTR_PROTO(ptrd)) 17*6dd63270SBarry Smith { 18*6dd63270SBarry Smith const PetscInt *idx; 19*6dd63270SBarry Smith PetscInt n; 20*6dd63270SBarry Smith *ierr = ISLocalToGlobalMappingGetIndices(*da, &idx); 21*6dd63270SBarry Smith if (*ierr) return; 22*6dd63270SBarry Smith *ierr = ISLocalToGlobalMappingGetSize(*da, &n); 23*6dd63270SBarry Smith if (*ierr) return; 24*6dd63270SBarry Smith *ierr = F90Array1dCreate((void *)idx, MPIU_INT, 1, n, indices PETSC_F90_2PTR_PARAM(ptrd)); 25*6dd63270SBarry Smith } 26*6dd63270SBarry Smith 27*6dd63270SBarry Smith PETSC_EXTERN void islocaltoglobalmappingrestoreindices_(ISLocalToGlobalMapping *da, F90Array1d *ptr, int *ierr PETSC_F90_2PTR_PROTO(ptrd)) 28*6dd63270SBarry Smith { 29*6dd63270SBarry Smith const PetscInt *fa; 30*6dd63270SBarry Smith 31*6dd63270SBarry Smith *ierr = F90Array1dAccess(ptr, MPIU_INT, (void **)&fa PETSC_F90_2PTR_PARAM(ptrd)); 32*6dd63270SBarry Smith if (*ierr) return; 33*6dd63270SBarry Smith *ierr = F90Array1dDestroy(ptr, MPIU_INT PETSC_F90_2PTR_PARAM(ptrd)); 34*6dd63270SBarry Smith if (*ierr) return; 35*6dd63270SBarry Smith *ierr = ISLocalToGlobalMappingRestoreIndices(*da, &fa); 36*6dd63270SBarry Smith if (*ierr) return; 37*6dd63270SBarry Smith } 38*6dd63270SBarry Smith 39*6dd63270SBarry Smith PETSC_EXTERN void islocaltoglobalmappinggetblockindices_(ISLocalToGlobalMapping *da, F90Array1d *indices, int *ierr PETSC_F90_2PTR_PROTO(ptrd)) 40*6dd63270SBarry Smith { 41*6dd63270SBarry Smith const PetscInt *idx; 42*6dd63270SBarry Smith PetscInt n; 43*6dd63270SBarry Smith *ierr = ISLocalToGlobalMappingGetBlockIndices(*da, &idx); 44*6dd63270SBarry Smith if (*ierr) return; 45*6dd63270SBarry Smith *ierr = ISLocalToGlobalMappingGetSize(*da, &n); 46*6dd63270SBarry Smith if (*ierr) return; 47*6dd63270SBarry Smith *ierr = F90Array1dCreate((void *)idx, MPIU_INT, 1, n, indices PETSC_F90_2PTR_PARAM(ptrd)); 48*6dd63270SBarry Smith } 49*6dd63270SBarry Smith 50*6dd63270SBarry Smith PETSC_EXTERN void islocaltoglobalmappingrestoreblockindices_(ISLocalToGlobalMapping *da, F90Array1d *ptr, int *ierr PETSC_F90_2PTR_PROTO(ptrd)) 51*6dd63270SBarry Smith { 52*6dd63270SBarry Smith const PetscInt *fa; 53*6dd63270SBarry Smith 54*6dd63270SBarry Smith *ierr = F90Array1dAccess(ptr, MPIU_INT, (void **)&fa PETSC_F90_2PTR_PARAM(ptrd)); 55*6dd63270SBarry Smith if (*ierr) return; 56*6dd63270SBarry Smith *ierr = F90Array1dDestroy(ptr, MPIU_INT PETSC_F90_2PTR_PARAM(ptrd)); 57*6dd63270SBarry Smith if (*ierr) return; 58*6dd63270SBarry Smith *ierr = ISLocalToGlobalMappingRestoreBlockIndices(*da, &fa); 59*6dd63270SBarry Smith if (*ierr) return; 60*6dd63270SBarry Smith } 61