1af0996ceSBarry Smith #include <petsc/private/fortranimpl.h> 2e7abf250SBlaise Bourdin #include <petscmat.h> 3665c2dedSJed Brown #include <petscviewer.h> 4e7abf250SBlaise Bourdin 5e7abf250SBlaise Bourdin #if defined(PETSC_HAVE_FORTRAN_CAPS) 6c3c607ccSBarry Smith #define matnullspacecreate0_ MATNULLSPACECREATE0 7c3c607ccSBarry Smith #define matnullspacecreate1_ MATNULLSPACECREATE1 84187c491SVincent Le Chenadec #define matnullspacegetvecs_ MATNULLSPACEGETVECS 9e7abf250SBlaise Bourdin #define matnullspaceview_ MATNULLSPACEVIEW 10e7abf250SBlaise Bourdin #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) 11c3c607ccSBarry Smith #define matnullspacecreate0_ matnullspacecreate0 12c3c607ccSBarry Smith #define matnullspacecreate1_ matnullspacecreate1 134187c491SVincent Le Chenadec #define matnullspacegetvecs_ matnullspacegetvecs 14e7abf250SBlaise Bourdin #define matnullspaceview_ matnullspaceview 15e7abf250SBlaise Bourdin #endif 16e7abf250SBlaise Bourdin 1719caf8f3SSatish Balay PETSC_EXTERN void matnullspacecreate0_(MPI_Fint *comm, PetscBool *has_cnst, PetscInt *n, Vec vecs[], MatNullSpace *SP, PetscErrorCode *ierr) 18c3c607ccSBarry Smith { 19c3c607ccSBarry Smith *ierr = MatNullSpaceCreate(MPI_Comm_f2c(*(comm)), *has_cnst, *n, vecs, SP); 20c3c607ccSBarry Smith } 21c3c607ccSBarry Smith 2219caf8f3SSatish Balay PETSC_EXTERN void matnullspacecreate1_(MPI_Fint *comm, PetscBool *has_cnst, PetscInt *n, Vec vecs[], MatNullSpace *SP, PetscErrorCode *ierr) 23c3c607ccSBarry Smith { 24c3c607ccSBarry Smith *ierr = MatNullSpaceCreate(MPI_Comm_f2c(*(comm)), *has_cnst, *n, vecs, SP); 25c3c607ccSBarry Smith } 26c3c607ccSBarry Smith 2719caf8f3SSatish Balay PETSC_EXTERN void matnullspacegetvecs_(MatNullSpace *sp, PetscBool *HAS_CNST, PetscInt *N, Vec *VECS, PetscErrorCode *ierr) 284187c491SVincent Le Chenadec { 294187c491SVincent Le Chenadec PetscBool has_cnst; 304187c491SVincent Le Chenadec PetscInt i, n; 314187c491SVincent Le Chenadec const Vec *vecs; 324187c491SVincent Le Chenadec 334187c491SVincent Le Chenadec CHKFORTRANNULLBOOL(HAS_CNST); 344187c491SVincent Le Chenadec CHKFORTRANNULLINTEGER(N); 354187c491SVincent Le Chenadec CHKFORTRANNULLOBJECT(VECS); 364187c491SVincent Le Chenadec 374187c491SVincent Le Chenadec *ierr = MatNullSpaceGetVecs(*sp, &has_cnst, &n, &vecs); 384187c491SVincent Le Chenadec 39*5975b3b6SBarry Smith if (HAS_CNST) { *HAS_CNST = has_cnst; } 40*5975b3b6SBarry Smith if (N) { *N = n; } 414187c491SVincent Le Chenadec if (VECS) { 42*5975b3b6SBarry Smith for (i = 0; i < n; i++) { VECS[i] = vecs[i]; } 434187c491SVincent Le Chenadec } 444187c491SVincent Le Chenadec } 454187c491SVincent Le Chenadec 4619caf8f3SSatish Balay PETSC_EXTERN void matnullspaceview_(MatNullSpace *sp, PetscViewer *vin, PetscErrorCode *ierr) 47e7abf250SBlaise Bourdin { 48e7abf250SBlaise Bourdin PetscViewer v; 49e7abf250SBlaise Bourdin PetscPatchDefaultViewers_Fortran(vin, v); 50e7abf250SBlaise Bourdin *ierr = MatNullSpaceView(*sp, v); 51e7abf250SBlaise Bourdin } 52