Date: 2025-03-29T05:58:29+00:00

Actual source code: zgasmf.c

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

      4: #if defined(PETSC_HAVE_FORTRAN_CAPS)
      5:   #define pcgasmdestroysubdomains_  PCGASMDESTROYSUBDOMAINS
      6:   #define pcgasmgetsubksp           PCGASMGETSUBKSP
      7:   #define pcgasmcreatesubdomains2d_ PCGASMCREATESUBDOMAINS2D
      8: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
      9:   #define pcgasmdestroysubdomains_  pcgasmdestroysubdomains
     10:   #define pcgasmgetsubksp           pcgasmgetsubksp
     11:   #define pcgasmcreatesubdomains2d_ pcgasmcreatesubdomains2d
     12: #endif

     14: PETSC_EXTERN void pcgasmdestroysubdomains_(PetscInt *n, F90Array1d *is1, F90Array1d *is2, int *ierr PETSC_F90_2PTR_PROTO(ptrd1) PETSC_F90_2PTR_PROTO(ptrd2))
     15: {
     16:   IS *isa, *isb;

     18:   *ierr = F90Array1dAccess(is1, MPIU_FORTRANADDR, (void **)&isa PETSC_F90_2PTR_PARAM(ptrd1));
     19:   if (*ierr) return;
     20:   *ierr = F90Array1dAccess(is2, MPIU_FORTRANADDR, (void **)&isb PETSC_F90_2PTR_PARAM(ptrd2));
     21:   if (*ierr) return;
     22:   *ierr = F90Array1dDestroy(is1, MPIU_FORTRANADDR PETSC_F90_2PTR_PARAM(ptrd1));
     23:   if (*ierr) return;
     24:   *ierr = F90Array1dDestroy(is2, MPIU_FORTRANADDR PETSC_F90_2PTR_PARAM(ptrd2));
     25:   if (*ierr) return;
     26:   *ierr = PCGASMDestroySubdomains(*n, &isa, &isb);
     27: }

     29: 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))
     30: {
     31:   IS *iis, *iisl;
     32:   *ierr = PCGASMCreateSubdomains2D(*pc, *m, *n, *M, *N, *dof, *overlap, Nsub, &iis, &iisl);
     33:   if (*ierr) return;
     34:   *ierr = F90Array1dCreate(iis, MPIU_FORTRANADDR, 1, *Nsub, is1 PETSC_F90_2PTR_PARAM(ptrd1));
     35:   if (*ierr) return;
     36:   *ierr = F90Array1dCreate(iisl, MPIU_FORTRANADDR, 1, *Nsub, is2 PETSC_F90_2PTR_PARAM(ptrd2));
     37:   if (*ierr) return;
     38: }

     40: PETSC_EXTERN void pcgasmgetsubksp_(PC *pc, PetscInt *n_local, PetscInt *first_local, F90Array1d *ksp, PetscErrorCode *ierr PETSC_F90_2PTR_PROTO(ptrd))
     41: {
     42:   KSP     *tksp;
     43:   PetscInt nloc, flocal;

     45:   CHKFORTRANNULLINTEGER(n_local);
     46:   CHKFORTRANNULLINTEGER(first_local);
     47:   *ierr = PCGASMGetSubKSP(*pc, &nloc, &flocal, &tksp);
     48:   if (n_local) *n_local = nloc;
     49:   if (first_local) *first_local = flocal;
     50:   *ierr = F90Array1dCreate(tksp, MPIU_FORTRANADDR, 1, nloc, ksp PETSC_F90_2PTR_PARAM(ptrd));
     51: }