Actual source code: ex220.c


  2: #include <petscmat.h>

  4: static char help[PETSC_MAX_PATH_LEN] = "Tests MatLoad() with MatCreateDense() for memory leak ";

  6: int main(int argc, char **argv)
  7: {
  8:     PetscViewer         viewer;
  9:     Mat                 A;
 10:     char                filename[PETSC_MAX_PATH_LEN];
 11:     PetscBool           flg;

 13:     PetscInitialize(&argc, &argv, (char*)0, help);
 14:     PetscOptionsGetString(NULL, NULL, "-f", filename, sizeof(filename), &flg);

 17:     PetscViewerBinaryOpen(PETSC_COMM_WORLD, filename, FILE_MODE_READ, &viewer);
 18:     MatCreateDense(PETSC_COMM_WORLD, PETSC_DECIDE, PETSC_DECIDE, 36, 36, NULL, &A);
 19:     MatLoad(A, viewer);
 20:     PetscViewerDestroy(&viewer);
 21:     MatDestroy(&A);
 22:     PetscFinalize();
 23:     return 0;
 24: }

 26: /*TEST

 28:      test:
 29:        requires: double !complex !defined(PETSC_USE_64BIT_INDICES) datafilespath
 30:        args: -f ${DATAFILESPATH}/matrices/small

 32: TEST*/