Actual source code: ex44.c

petsc-3.8.4 2018-03-24
Report Typos and Errors

  2: static char help[] = "Loads matrix dumped by ex43.\n\n";

  4:  #include <petscmat.h>

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

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