Date: 2026-03-31T05:46:39+00:00

Actual source code: zvectorf.c

      1: #include <petsc/private/ftnimpl.h>
      2: #include <petscvec.h>
      3: #include <petscviewer.h>

      5: #if defined(PETSC_HAVE_FORTRAN_CAPS)
      6:   #define vecgetownershipranges_     VECGETOWNERSHIPRANGES
      7:   #define vecrestoreownershipranges_ VECRESTOREOWNERSHIPRANGES
      8: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
      9:   #define vecgetownershipranges_     vecgetownershipranges
     10:   #define vecrestoreownershipranges_ vecrestoreownershipranges
     11: #endif

     13: PETSC_EXTERN void vecgetownershipranges_(Vec *v, F90Array1d *ptr, PetscErrorCode *ierr PETSC_F90_2PTR_PROTO(ptrd))
     14: {
     15:   PetscInt   *fa;
     16:   PetscMPIInt size;

     18:   *ierr = VecGetOwnershipRanges(*v, (const PetscInt **)&fa);
     19:   if (*ierr) return;
     20:   MPI_Comm_size(PetscObjectComm((PetscObject)*v), &size);
     21:   *ierr = F90Array1dCreate(fa, MPIU_INT, 1, size + 1, ptr PETSC_F90_2PTR_PARAM(ptrd));
     22: }

     24: PETSC_EXTERN void vecrestoreownershipranges_(Vec *v, F90Array1d *ptr, PetscErrorCode *ierr PETSC_F90_2PTR_PROTO(ptrd))
     25: {
     26:   *ierr = F90Array1dDestroy(ptr, MPIU_INT PETSC_F90_2PTR_PARAM(ptrd));
     27: }