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

Actual source code: zmgf.c

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

      4: #if defined(PETSC_HAVE_FORTRAN_CAPS)
      5:   #define pcmgsetlevels_ PCMGSETLEVELS
      6: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
      7:   #define pcmgsetlevels_ pcmgsetlevels
      8: #endif

     10: PETSC_EXTERN void pcmgsetlevels_(PC *pc, PetscInt *levels, MPI_Fint fcomms[], PetscErrorCode *ierr)
     11: {
     12:   MPI_Comm *ccomms = NULL;
     13:   CHKFORTRANNULLMPICOMM(fcomms);
     14:   if (fcomms) {
     15:     *ierr = PetscMalloc1(*levels, &ccomms);
     16:     if (*ierr) return;
     17:     for (PetscInt i = 0; i < *levels; i++) { ccomms[i] = MPI_Comm_f2c(fcomms[i]); }
     18:   }
     19:   *ierr = PCMGSetLevels(*pc, *levels, ccomms);
     20:   if (*ierr) return;
     21:   if (fcomms) *ierr = PetscFree(ccomms);
     22: }