Actual source code: ex13.c
petsc-3.11.4 2019-09-28
2: static char help[] = "Tests loading DM vector from file.\n\n";
4: /*
5: ex14.c writes out the DMDA and vector read by this program.
6: */
8: #include <petscdmda.h>
10: int main(int argc,char **argv)
11: {
13: PetscInt M = PETSC_DECIDE,N = PETSC_DECIDE;
14: DM da;
15: Vec global;
16: PetscViewer bviewer;
18: PetscInitialize(&argc,&argv,(char*)0,help);if (ierr) return ierr;
19: PetscOptionsGetInt(NULL,NULL,"-M",&M,NULL);
20: PetscOptionsGetInt(NULL,NULL,"-N",&N,NULL);
22: PetscViewerBinaryOpen(PETSC_COMM_WORLD,"daoutput",FILE_MODE_READ,&bviewer);
23: DMCreate(PETSC_COMM_WORLD,&da);
25: DMLoad(da,bviewer);
26: DMCreateGlobalVector(da,&global);
27: VecLoad(global,bviewer);
28: PetscViewerDestroy(&bviewer);
30: VecView(global,PETSC_VIEWER_DRAW_WORLD);
32: /* Free memory */
33: VecDestroy(&global);
34: DMDestroy(&da);
35: PetscFinalize();
36: return ierr;
37: }