Actual source code: ex13.c

  2: static char help[] = "Tests loading DM vector from file.\n\n";

  4: #include <petscdmda.h>

  8: int main(int argc,char **argv)
  9: {
 11:   PetscInt       M = PETSC_DECIDE,N = PETSC_DECIDE;
 12:   DM             da;
 13:   Vec            global;
 14:   PetscViewer    bviewer;

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

 18:   /* Read options */
 19:   PetscOptionsGetInt(PETSC_NULL,"-M",&M,PETSC_NULL);
 20:   PetscOptionsGetInt(PETSC_NULL,"-N",&N,PETSC_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);


 31:   VecView(global,PETSC_VIEWER_DRAW_WORLD);


 34:   /* Free memory */
 35:   VecDestroy(&global);
 36:   DMDestroy(&da);
 37:   PetscFinalize();
 38:   return 0;
 39: }
 40: