1*ce78bad3SBarry Smith #include <petsc/private/f90impl.h> 2768de9afSRichard Tran Mills #include <petscksp.h> 3768de9afSRichard Tran Mills 4768de9afSRichard Tran Mills #if defined(PETSC_HAVE_FORTRAN_CAPS) 5b3598b19SBarry Smith #define pcgasmdestroysubdomains_ PCGASMDESTROYSUBDOMAINS 6*ce78bad3SBarry Smith #define pcgasmgetsubksp PCGASMGETSUBKSP 76141accfSBarry Smith #define pcgasmcreatesubdomains2d_ PCGASMCREATESUBDOMAINS2D 8768de9afSRichard Tran Mills #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) 9b3598b19SBarry Smith #define pcgasmdestroysubdomains_ pcgasmdestroysubdomains 106141accfSBarry Smith #define pcgasmcreatesubdomains2d_ pcgasmcreatesubdomains2d 11768de9afSRichard Tran Mills #endif 12768de9afSRichard Tran Mills 13*ce78bad3SBarry Smith PETSC_EXTERN void pcgasmdestroysubdomains_(PetscInt *n, F90Array1d *is1, F90Array1d *is2, int *ierr PETSC_F90_2PTR_PROTO(ptrd1) PETSC_F90_2PTR_PROTO(ptrd2)) 14b3598b19SBarry Smith { 15*ce78bad3SBarry Smith IS *isa, *isb; 16*ce78bad3SBarry Smith 17*ce78bad3SBarry Smith *ierr = F90Array1dAccess(is1, MPIU_FORTRANADDR, (void **)&isa PETSC_F90_2PTR_PARAM(ptrd1)); 18b3598b19SBarry Smith if (*ierr) return; 19*ce78bad3SBarry Smith *ierr = F90Array1dAccess(is2, MPIU_FORTRANADDR, (void **)&isb PETSC_F90_2PTR_PARAM(ptrd2)); 20b3598b19SBarry Smith if (*ierr) return; 21*ce78bad3SBarry Smith *ierr = F90Array1dDestroy(is1, MPIU_FORTRANADDR PETSC_F90_2PTR_PARAM(ptrd1)); 22b3598b19SBarry Smith if (*ierr) return; 23*ce78bad3SBarry Smith *ierr = F90Array1dDestroy(is2, MPIU_FORTRANADDR PETSC_F90_2PTR_PARAM(ptrd2)); 24*ce78bad3SBarry Smith if (*ierr) return; 25*ce78bad3SBarry Smith *ierr = PCGASMDestroySubdomains(*n, &isa, &isb); 26b3598b19SBarry Smith } 27b3598b19SBarry Smith 28*ce78bad3SBarry Smith PETSC_EXTERN void pcgasmcreatesubdomains2d_(PC *pc, PetscInt *m, PetscInt *n, PetscInt *M, PetscInt *N, PetscInt *dof, PetscInt *overlap, PetscInt *Nsub, F90Array1d *is1, F90Array1d *is2, int *ierr PETSC_F90_2PTR_PROTO(ptrd1) PETSC_F90_2PTR_PROTO(ptrd2)) 296141accfSBarry Smith { 306141accfSBarry Smith IS *iis, *iisl; 316141accfSBarry Smith *ierr = PCGASMCreateSubdomains2D(*pc, *m, *n, *M, *N, *dof, *overlap, Nsub, &iis, &iisl); 326141accfSBarry Smith if (*ierr) return; 33*ce78bad3SBarry Smith *ierr = F90Array1dCreate(iis, MPIU_FORTRANADDR, 1, *Nsub, is1 PETSC_F90_2PTR_PARAM(ptrd1)); 346141accfSBarry Smith if (*ierr) return; 35*ce78bad3SBarry Smith *ierr = F90Array1dCreate(iisl, MPIU_FORTRANADDR, 1, *Nsub, is2 PETSC_F90_2PTR_PARAM(ptrd2)); 366141accfSBarry Smith if (*ierr) return; 376141accfSBarry Smith } 386141accfSBarry Smith 39*ce78bad3SBarry Smith PETSC_EXTERN void pcgasmgetsubksp_(PC *pc, PetscInt *n_local, PetscInt *first_local, F90Array1d *ksp, PetscErrorCode *ierr PETSC_F90_2PTR_PROTO(ptrd)) 40768de9afSRichard Tran Mills { 41768de9afSRichard Tran Mills KSP *tksp; 42*ce78bad3SBarry Smith PetscInt nloc, flocal; 43*ce78bad3SBarry Smith 44768de9afSRichard Tran Mills CHKFORTRANNULLINTEGER(n_local); 45768de9afSRichard Tran Mills CHKFORTRANNULLINTEGER(first_local); 46*ce78bad3SBarry Smith *ierr = PCGASMGetSubKSP(*pc, &nloc, &flocal, &tksp); 47768de9afSRichard Tran Mills if (n_local) *n_local = nloc; 48*ce78bad3SBarry Smith if (first_local) *first_local = flocal; 49*ce78bad3SBarry Smith *ierr = F90Array1dCreate(tksp, MPIU_FORTRANADDR, 1, nloc, ksp PETSC_F90_2PTR_PARAM(ptrd)); 5059fc98c0SBarry Smith } 51