Actual source code: ex44.c

petsc-3.4.5 2014-06-29
  2: static char help[] = "Loads matrix dumped by ex43.\n\n";

  4: #include <petscmat.h>

  8: int main(int argc,char **args)
  9: {
 10:   Mat            C;
 11:   PetscViewer    viewer;

 14:   PetscInitialize(&argc,&args,0,help);
 15:   PetscViewerBinaryOpen(PETSC_COMM_WORLD,"matrix.dat",FILE_MODE_READ,&viewer);
 16:   MatCreate(PETSC_COMM_WORLD,&C);
 17:   MatSetType(C,MATMPIDENSE);
 18:   MatLoad(C,viewer);
 19:   PetscViewerDestroy(&viewer);
 20:   MatView(C,PETSC_VIEWER_STDOUT_WORLD);
 21:   MatDestroy(&C);
 22:   PetscFinalize();
 23:   return 0;
 24: }