Actual source code: ex66.c

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

  2: static char help[] = "Reads in rectangular matrix from disk, stored from ex65.c\n\n";

  4:  #include <petscmat.h>

  6: int main(int argc,char **args)
  7: {
  9:   Mat            A;
 10:   PetscViewer    fd;

 12:   PetscInitialize(&argc,&args,(char*)0,help);if (ierr) return ierr;
 13:   /* Read matrix and RHS */
 14:   PetscViewerBinaryOpen(PETSC_COMM_WORLD,"rect",FILE_MODE_READ,&fd);
 15:   MatCreate(PETSC_COMM_WORLD,&A);
 16:   MatSetType(A,MATSEQAIJ);
 17:   MatLoad(A,fd);
 18:   PetscViewerDestroy(&fd);

 20:   /* Free data structures */
 21:   MatDestroy(&A);

 23:   PetscFinalize();
 24:   return ierr;
 25: }