16dd63270SBarry Smith #include <petsc/private/ftnimpl.h> 2e7abf250SBlaise Bourdin #include <petscmat.h> 3665c2dedSJed Brown #include <petscviewer.h> 4e7abf250SBlaise Bourdin 5e7abf250SBlaise Bourdin #if defined(PETSC_HAVE_FORTRAN_CAPS) 64187c491SVincent Le Chenadec #define matnullspacegetvecs_ MATNULLSPACEGETVECS 7*8c31b630SBarry Smith #define matnullspacerestorevecs_ MATNULLSPACERESTOREVECS 8e7abf250SBlaise Bourdin #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) 94187c491SVincent Le Chenadec #define matnullspacegetvecs_ matnullspacegetvecs 10*8c31b630SBarry Smith #define matnullspacerestorevecs_ matnullspacerestorevecs 11e7abf250SBlaise Bourdin #endif 12e7abf250SBlaise Bourdin 13*8c31b630SBarry Smith PETSC_EXTERN void matnullspacegetvecs_(MatNullSpace *sp, PetscBool *HAS_CNST, PetscInt *N, F90Array1d *vecs, PetscErrorCode *ierr PETSC_F90_2PTR_PROTO(ptrd)) 144187c491SVincent Le Chenadec { 154187c491SVincent Le Chenadec PetscBool has_cnst; 16*8c31b630SBarry Smith PetscInt n; 17*8c31b630SBarry Smith Vec *tvecs; 184187c491SVincent Le Chenadec 194187c491SVincent Le Chenadec CHKFORTRANNULLBOOL(HAS_CNST); 204187c491SVincent Le Chenadec CHKFORTRANNULLINTEGER(N); 21*8c31b630SBarry Smith *ierr = MatNullSpaceGetVecs(*sp, &has_cnst, &n, (const Vec **)&tvecs); 22*8c31b630SBarry Smith if (HAS_CNST) *HAS_CNST = has_cnst; 23*8c31b630SBarry Smith if (N) *N = n; 24*8c31b630SBarry Smith *ierr = F90Array1dCreate(tvecs, MPIU_FORTRANADDR, 1, n, vecs PETSC_F90_2PTR_PARAM(ptrd)); 254187c491SVincent Le Chenadec } 26*8c31b630SBarry Smith 27*8c31b630SBarry Smith PETSC_EXTERN void matnullspacerestorevecs_(MatNullSpace *sp, PetscBool *HAS_CNST, PetscInt *N, F90Array1d *vecs, PetscErrorCode *ierr PETSC_F90_2PTR_PROTO(ptrd)) 28*8c31b630SBarry Smith { 29*8c31b630SBarry Smith *ierr = F90Array1dDestroy(vecs, MPIU_FORTRANADDR PETSC_F90_2PTR_PARAM(ptrd)); 304187c491SVincent Le Chenadec } 31