Actual source code: ex13.c

petsc-3.5.4 2015-05-23
Report Typos and Errors
  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>

 12: int main(int argc,char **argv)
 13: {
 15:   PetscInt       M = PETSC_DECIDE,N = PETSC_DECIDE;
 16:   DM             da;
 17:   Vec            global;
 18:   PetscViewer    bviewer;

 20:   PetscInitialize(&argc,&argv,(char*)0,help);

 22:   /* Read options */
 23:   PetscOptionsGetInt(NULL,"-M",&M,NULL);
 24:   PetscOptionsGetInt(NULL,"-N",&N,NULL);

 26:   PetscViewerBinaryOpen(PETSC_COMM_WORLD,"daoutput",FILE_MODE_READ,&bviewer);
 27:   DMCreate(PETSC_COMM_WORLD,&da);

 29:   DMLoad(da,bviewer);
 30:   DMCreateGlobalVector(da,&global);
 31:   VecLoad(global,bviewer);
 32:   PetscViewerDestroy(&bviewer);


 35:   VecView(global,PETSC_VIEWER_DRAW_WORLD);


 38:   /* Free memory */
 39:   VecDestroy(&global);
 40:   DMDestroy(&da);
 41:   PetscFinalize();
 42:   return 0;
 43: }