Actual source code: zmat.c

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

  4: #if defined(PETSC_HAVE_FORTRAN_CAPS)
  5:   #define matsetvalue_                   MATSETVALUE
  6:   #define matsetvaluelocal_              MATSETVALUELOCAL
  7:   #define matdiagonalscale_              MATDIAGONALSCALE
  8:   #define matsetpreallocationcoo32_      MATSETPREALLOCATIONCOO32
  9:   #define matsetpreallocationcoolocal32_ MATSETPREALLOCATIONCOOLOCAL32
 10:   #define matsetpreallocationcoo64_      MATSETPREALLOCATIONCOO64
 11:   #define matsetpreallocationcoolocal64_ MATSETPREALLOCATIONCOOLOCAL64
 12: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
 13:   #define matsetvalue_                   matsetvalue
 14:   #define matsetvaluelocal_              matsetvaluelocal
 15:   #define matdiagonalscale_              matdiagonalscale
 16:   #define matsetpreallocationcoo32_      matsetpreallocationcoo32
 17:   #define matsetpreallocationcoolocal32_ matsetpreallocationcoolocal32
 18:   #define matsetpreallocationcoo64       matsetpreallocationcoo64
 19:   #define matsetpreallocationcoolocal64_ matsetpreallocationcoolocal64
 20: #endif

 22: PETSC_EXTERN void matsetvalue_(Mat *mat, PetscInt *i, PetscInt *j, PetscScalar *va, InsertMode *mode, PetscErrorCode *ierr)
 23: {
 24:   /* cannot use MatSetValue() here since that uses PetscCall() which has a return in it */
 25:   *ierr = MatSetValues(*mat, 1, i, 1, j, va, *mode);
 26: }

 28: PETSC_EXTERN void matsetvaluelocal_(Mat *mat, PetscInt *i, PetscInt *j, PetscScalar *va, InsertMode *mode, PetscErrorCode *ierr)
 29: {
 30:   /* cannot use MatSetValueLocal() here since that uses PetscCall() which has a return in it */
 31:   *ierr = MatSetValuesLocal(*mat, 1, i, 1, j, va, *mode);
 32: }

 34: PETSC_EXTERN void matsetpreallocationcoo32_(Mat *A, int *ncoo, PetscInt coo_i[], PetscInt coo_j[], int *ierr)
 35: {
 36:   *ierr = MatSetPreallocationCOO(*A, *ncoo, coo_i, coo_j);
 37: }

 39: PETSC_EXTERN void matsetpreallocationcoo64_(Mat *A, PetscInt64 *ncoo, PetscInt coo_i[], PetscInt coo_j[], int *ierr)
 40: {
 41:   *ierr = MatSetPreallocationCOO(*A, *ncoo, coo_i, coo_j);
 42: }

 44: PETSC_EXTERN void matsetpreallocationcoolocal32_(Mat *A, int *ncoo, PetscInt coo_i[], PetscInt coo_j[], int *ierr)
 45: {
 46:   *ierr = MatSetPreallocationCOOLocal(*A, *ncoo, coo_i, coo_j);
 47: }

 49: PETSC_EXTERN void matsetpreallocationcoolocal64_(Mat *A, PetscInt64 *ncoo, PetscInt coo_i[], PetscInt coo_j[], int *ierr)
 50: {
 51:   *ierr = MatSetPreallocationCOOLocal(*A, *ncoo, coo_i, coo_j);
 52: }