xref: /petsc/src/ksp/pc/impls/bjacobi/ftn-custom/zbjacobif.c (revision ce78bad369055609e946c9d2c25ea67a45873e27)
1*ce78bad3SBarry Smith #include <petsc/private/f90impl.h>
2c6db04a5SJed Brown #include <petscksp.h>
3e54e4138SSatish Balay 
4e54e4138SSatish Balay #if defined(PETSC_HAVE_FORTRAN_CAPS)
5*ce78bad3SBarry Smith   #define pcbjacobigetsubksp_ PCBJACOBIGETSUBKSP
6e54e4138SSatish Balay #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
7*ce78bad3SBarry Smith   #define pcbjacobigetsubksp_ pcbjacobigetsubksp
8e54e4138SSatish Balay #endif
9e54e4138SSatish Balay 
10*ce78bad3SBarry Smith PETSC_EXTERN void pcbjacobigetsubksp_(PC *pc, PetscInt *n_local, PetscInt *first_local, F90Array1d *ksp, PetscErrorCode *ierr PETSC_F90_2PTR_PROTO(ptrd))
11e54e4138SSatish Balay {
12e54e4138SSatish Balay   KSP     *tksp;
13*ce78bad3SBarry Smith   PetscInt nloc, flocal;
14*ce78bad3SBarry Smith   size_t  *iksp;
15*ce78bad3SBarry Smith 
16e54e4138SSatish Balay   CHKFORTRANNULLINTEGER(n_local);
17e54e4138SSatish Balay   CHKFORTRANNULLINTEGER(first_local);
18*ce78bad3SBarry Smith   *ierr = PCBJacobiGetSubKSP(*pc, &nloc, &flocal, &tksp);
19e54e4138SSatish Balay   if (n_local) *n_local = nloc;
20*ce78bad3SBarry Smith   if (first_local) *first_local = flocal;
21*ce78bad3SBarry Smith   *ierr = F90Array1dAccess(ksp, MPIU_FORTRANADDR, (void **)&iksp PETSC_F90_2PTR_PARAM(ptrd));
22*ce78bad3SBarry Smith   if (*ierr) return;
23*ce78bad3SBarry Smith   if (!iksp || *iksp == 0) { *ierr = F90Array1dCreate(tksp, MPIU_FORTRANADDR, 1, nloc, ksp PETSC_F90_2PTR_PARAM(ptrd)); }
2417a42bb7SSatish Balay }
25