Actual source code: zmatregf.c

  1: #include <petsc/private/fortranimpl.h>
  2: #include <petscmat.h>

  4: #if defined(PETSC_HAVE_FORTRAN_CAPS)
  5:   #define matsettype_    MATSETTYPE
  6:   #define matgettype_    MATGETTYPE
  7:   #define matsetvectype_ MATSETVECTYPE
  8:   #define matgetvectype_ MATGETVECTYPE
  9: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
 10:   #define matsettype_    matsettype
 11:   #define matgettype_    matgettype
 12:   #define matsetvectype_ matsetvectype
 13:   #define matgetvectype_ matgetvectype
 14: #endif

 16: PETSC_EXTERN void matsettype_(Mat *x, char *type_name, PetscErrorCode *ierr, PETSC_FORTRAN_CHARLEN_T len)
 17: {
 18:   char *t;

 20:   FIXCHAR(type_name, len, t);
 21:   *ierr = MatSetType(*x, t);
 22:   if (*ierr) return;
 23:   FREECHAR(type_name, t);
 24: }

 26: PETSC_EXTERN void matgettype_(Mat *mm, char *name, PetscErrorCode *ierr, PETSC_FORTRAN_CHARLEN_T len)
 27: {
 28:   const char *tname;

 30:   *ierr = MatGetType(*mm, &tname);
 31:   if (*ierr) return;
 32:   if (name != PETSC_NULL_CHARACTER_Fortran) {
 33:     *ierr = PetscStrncpy(name, tname, len);
 34:     if (*ierr) return;
 35:   }
 36:   FIXRETURNCHAR(PETSC_TRUE, name, len);
 37: }

 39: PETSC_EXTERN void matsetvectype_(Mat *x, char *type_name, PetscErrorCode *ierr, PETSC_FORTRAN_CHARLEN_T len)
 40: {
 41:   char *t;

 43:   FIXCHAR(type_name, len, t);
 44:   *ierr = MatSetVecType(*x, t);
 45:   if (*ierr) return;
 46:   FREECHAR(type_name, t);
 47: }

 49: PETSC_EXTERN void matgetvectype_(Mat *mm, char *name, PetscErrorCode *ierr, PETSC_FORTRAN_CHARLEN_T len)
 50: {
 51:   const char *tname;

 53:   *ierr = MatGetVecType(*mm, &tname);
 54:   if (*ierr) return;
 55:   if (name != PETSC_NULL_CHARACTER_Fortran) {
 56:     *ierr = PetscStrncpy(name, tname, len);
 57:     if (*ierr) return;
 58:   }
 59:   FIXRETURNCHAR(PETSC_TRUE, name, len);
 60: }