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;

 18:   PetscInitialize(&argc, &argv, (char *)0, help);
 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 0;
 37: }