Actual source code: ex119.c
petsc-3.6.1 2015-08-06
1: static char help[] = "Tests binary MatView() for MPIDENSE matrices \n\n";
3: #include <petscmat.h>
8: int main(int argc,char **args)
9: {
11: Mat A;
12: PetscViewer viewer;
13: char inputfile[256],outputfile[256];
14: PetscBool flg;
16: PetscInitialize(&argc,&args,(char*)0,help);
17: PetscOptionsGetString(NULL,"-inputfile",inputfile,256,&flg);
18: PetscOptionsGetString(NULL,"-outputfile",outputfile,256,&flg);
19: PetscViewerBinaryOpen(PETSC_COMM_WORLD,inputfile,FILE_MODE_READ,&viewer);
20: MatCreate(PETSC_COMM_WORLD,&A);
21: MatSetType(A,MATDENSE);
22: MatLoad(A,viewer);
23: PetscViewerDestroy(&viewer);
24: PetscViewerBinaryOpen(PETSC_COMM_WORLD,outputfile,FILE_MODE_WRITE,&viewer);
25: MatView(A,viewer);
26: PetscViewerDestroy(&viewer);
27: PetscFinalize();
28: return(0);
29: }