Actual source code: ex13.c


  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: {
 12:   PetscInt       M = PETSC_DECIDE,N = PETSC_DECIDE;
 13:   DM             da;
 14:   Vec            global;
 15:   PetscViewer    bviewer;

 17:   PetscInitialize(&argc,&argv,(char*)0,help);
 18:   PetscOptionsGetInt(NULL,NULL,"-M",&M,NULL);
 19:   PetscOptionsGetInt(NULL,NULL,"-N",&N,NULL);

 21:   PetscViewerBinaryOpen(PETSC_COMM_WORLD,"daoutput",FILE_MODE_READ,&bviewer);
 22:   DMCreate(PETSC_COMM_WORLD,&da);

 24:   DMLoad(da,bviewer);
 25:   DMCreateGlobalVector(da,&global);
 26:   VecLoad(global,bviewer);
 27:   PetscViewerDestroy(&bviewer);

 29:   VecView(global,PETSC_VIEWER_DRAW_WORLD);

 31:   /* Free memory */
 32:   VecDestroy(&global);
 33:   DMDestroy(&da);
 34:   PetscFinalize();
 35:   return 0;
 36: }