1768de9afSRichard Tran Mills #include <petsc/private/fortranimpl.h> 2768de9afSRichard Tran Mills #include <petscksp.h> 3768de9afSRichard Tran Mills 4768de9afSRichard Tran Mills #if defined(PETSC_HAVE_FORTRAN_CAPS) 5ab32a8f3SSatish Balay #define pcgasmgetsubksp1_ PCGASMGETSUBKSP1 6ab32a8f3SSatish Balay #define pcgasmgetsubksp2_ PCGASMGETSUBKSP2 759fc98c0SBarry Smith #define pcgasmgetsubksp3_ PCGASMGETSUBKSP3 859fc98c0SBarry Smith #define pcgasmgetsubksp4_ PCGASMGETSUBKSP4 959fc98c0SBarry Smith #define pcgasmgetsubksp5_ PCGASMGETSUBKSP5 1059fc98c0SBarry Smith #define pcgasmgetsubksp6_ PCGASMGETSUBKSP6 1159fc98c0SBarry Smith #define pcgasmgetsubksp7_ PCGASMGETSUBKSP7 1259fc98c0SBarry Smith #define pcgasmgetsubksp8_ PCGASMGETSUBKSP8 13*6141accfSBarry Smith #define pcgasmcreatesubdomains2d_ PCGASMCREATESUBDOMAINS2D 14768de9afSRichard Tran Mills #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) 15ab32a8f3SSatish Balay #define pcgasmgetsubksp1_ pcgasmgetsubksp1 16ab32a8f3SSatish Balay #define pcgasmgetsubksp2_ pcgasmgetsubksp2 1759fc98c0SBarry Smith #define pcgasmgetsubksp3_ pcgasmgetsubksp3 1859fc98c0SBarry Smith #define pcgasmgetsubksp4_ pcgasmgetsubksp4 1959fc98c0SBarry Smith #define pcgasmgetsubksp5_ pcgasmgetsubksp5 2059fc98c0SBarry Smith #define pcgasmgetsubksp6_ pcgasmgetsubksp6 2159fc98c0SBarry Smith #define pcgasmgetsubksp7_ pcgasmgetsubksp7 2259fc98c0SBarry Smith #define pcgasmgetsubksp8_ pcgasmgetsubksp8 23*6141accfSBarry Smith #define pcgasmcreatesubdomains2d_ pcgasmcreatesubdomains2d 24768de9afSRichard Tran Mills #endif 25768de9afSRichard Tran Mills 26*6141accfSBarry Smith PETSC_EXTERN void pcgasmcreatesubdomains2d_(PC *pc, PetscInt *m, PetscInt *n, PetscInt *M, PetscInt *N, PetscInt *dof, PetscInt *overlap, PetscInt *Nsub, IS *is, IS *isl, int *ierr) 27*6141accfSBarry Smith { 28*6141accfSBarry Smith IS *iis, *iisl; 29*6141accfSBarry Smith *ierr = PCGASMCreateSubdomains2D(*pc, *m, *n, *M, *N, *dof, *overlap, Nsub, &iis, &iisl); 30*6141accfSBarry Smith if (*ierr) return; 31*6141accfSBarry Smith *ierr = PetscMemcpy(is, iis, *Nsub * sizeof(IS)); 32*6141accfSBarry Smith if (*ierr) return; 33*6141accfSBarry Smith *ierr = PetscMemcpy(isl, iisl, *Nsub * sizeof(IS)); 34*6141accfSBarry Smith if (*ierr) return; 35*6141accfSBarry Smith *ierr = PetscFree(iis); 36*6141accfSBarry Smith if (*ierr) return; 37*6141accfSBarry Smith *ierr = PetscFree(iisl); 38*6141accfSBarry Smith } 39*6141accfSBarry Smith 40ab32a8f3SSatish Balay PETSC_EXTERN void pcgasmgetsubksp1_(PC *pc, PetscInt *n_local, PetscInt *first_local, KSP *ksp, PetscErrorCode *ierr) 41768de9afSRichard Tran Mills { 42768de9afSRichard Tran Mills KSP *tksp; 43768de9afSRichard Tran Mills PetscInt i, nloc; 44768de9afSRichard Tran Mills CHKFORTRANNULLINTEGER(n_local); 45768de9afSRichard Tran Mills CHKFORTRANNULLINTEGER(first_local); 46768de9afSRichard Tran Mills CHKFORTRANNULLOBJECT(ksp); 47768de9afSRichard Tran Mills *ierr = PCGASMGetSubKSP(*pc, &nloc, first_local, &tksp); 48768de9afSRichard Tran Mills if (n_local) *n_local = nloc; 49768de9afSRichard Tran Mills if (ksp) { 50768de9afSRichard Tran Mills for (i = 0; i < nloc; i++) ksp[i] = tksp[i]; 51768de9afSRichard Tran Mills } 52768de9afSRichard Tran Mills } 53768de9afSRichard Tran Mills 54ab32a8f3SSatish Balay PETSC_EXTERN void pcgasmgetsubksp2_(PC *pc, PetscInt *n_local, PetscInt *first_local, KSP *ksp, PetscErrorCode *ierr) 55ab32a8f3SSatish Balay { 56ab32a8f3SSatish Balay pcgasmgetsubksp1_(pc, n_local, first_local, ksp, ierr); 57ab32a8f3SSatish Balay } 5859fc98c0SBarry Smith 5959fc98c0SBarry Smith PETSC_EXTERN void pcgasmgetsubksp3_(PC *pc, PetscInt *n_local, PetscInt *first_local, KSP *ksp, PetscErrorCode *ierr) 6059fc98c0SBarry Smith { 6159fc98c0SBarry Smith pcgasmgetsubksp1_(pc, n_local, first_local, ksp, ierr); 6259fc98c0SBarry Smith } 6359fc98c0SBarry Smith 6459fc98c0SBarry Smith PETSC_EXTERN void pcgasmgetsubksp4_(PC *pc, PetscInt *n_local, PetscInt *first_local, KSP *ksp, PetscErrorCode *ierr) 6559fc98c0SBarry Smith { 6659fc98c0SBarry Smith pcgasmgetsubksp1_(pc, n_local, first_local, ksp, ierr); 6759fc98c0SBarry Smith } 6859fc98c0SBarry Smith 6959fc98c0SBarry Smith PETSC_EXTERN void pcgasmgetsubksp5_(PC *pc, PetscInt *n_local, PetscInt *first_local, KSP *ksp, PetscErrorCode *ierr) 7059fc98c0SBarry Smith { 7159fc98c0SBarry Smith pcgasmgetsubksp1_(pc, n_local, first_local, ksp, ierr); 7259fc98c0SBarry Smith } 7359fc98c0SBarry Smith 7459fc98c0SBarry Smith PETSC_EXTERN void pcgasmgetsubksp6_(PC *pc, PetscInt *n_local, PetscInt *first_local, KSP *ksp, PetscErrorCode *ierr) 7559fc98c0SBarry Smith { 7659fc98c0SBarry Smith pcgasmgetsubksp1_(pc, n_local, first_local, ksp, ierr); 7759fc98c0SBarry Smith } 7859fc98c0SBarry Smith 7959fc98c0SBarry Smith PETSC_EXTERN void pcgasmgetsubksp7_(PC *pc, PetscInt *n_local, PetscInt *first_local, KSP *ksp, PetscErrorCode *ierr) 8059fc98c0SBarry Smith { 8159fc98c0SBarry Smith pcgasmgetsubksp1_(pc, n_local, first_local, ksp, ierr); 8259fc98c0SBarry Smith } 8359fc98c0SBarry Smith 8459fc98c0SBarry Smith PETSC_EXTERN void pcgasmgetsubksp8_(PC *pc, PetscInt *n_local, PetscInt *first_local, KSP *ksp, PetscErrorCode *ierr) 8559fc98c0SBarry Smith { 8659fc98c0SBarry Smith pcgasmgetsubksp1_(pc, n_local, first_local, ksp, ierr); 8759fc98c0SBarry Smith } 88