xref: /petsc/src/mat/interface/ftn-custom/zmatnullf.c (revision 6dd63270497ad23dcf16ae500a87ff2b2a0b7474)
1*6dd63270SBarry 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
7e7abf250SBlaise Bourdin #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
84187c491SVincent Le Chenadec   #define matnullspacegetvecs_ matnullspacegetvecs
9e7abf250SBlaise Bourdin #endif
10e7abf250SBlaise Bourdin 
1119caf8f3SSatish Balay PETSC_EXTERN void matnullspacegetvecs_(MatNullSpace *sp, PetscBool *HAS_CNST, PetscInt *N, Vec *VECS, PetscErrorCode *ierr)
124187c491SVincent Le Chenadec {
134187c491SVincent Le Chenadec   PetscBool  has_cnst;
144187c491SVincent Le Chenadec   PetscInt   i, n;
154187c491SVincent Le Chenadec   const Vec *vecs;
164187c491SVincent Le Chenadec 
174187c491SVincent Le Chenadec   CHKFORTRANNULLBOOL(HAS_CNST);
184187c491SVincent Le Chenadec   CHKFORTRANNULLINTEGER(N);
194187c491SVincent Le Chenadec   CHKFORTRANNULLOBJECT(VECS);
204187c491SVincent Le Chenadec 
214187c491SVincent Le Chenadec   *ierr = MatNullSpaceGetVecs(*sp, &has_cnst, &n, &vecs);
224187c491SVincent Le Chenadec 
235975b3b6SBarry Smith   if (HAS_CNST) { *HAS_CNST = has_cnst; }
245975b3b6SBarry Smith   if (N) { *N = n; }
254187c491SVincent Le Chenadec   if (VECS) {
265975b3b6SBarry Smith     for (i = 0; i < n; i++) { VECS[i] = vecs[i]; }
274187c491SVincent Le Chenadec   }
284187c491SVincent Le Chenadec }
29