Actual source code: ex13.c

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

 4:  #include petscda.h
 5:  #include petscsys.h

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

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

 19:   /* Read options */
 20:   PetscOptionsGetInt(PETSC_NULL,"-M",&M,PETSC_NULL);
 21:   PetscOptionsGetInt(PETSC_NULL,"-N",&N,PETSC_NULL);

 23:   PetscViewerBinaryOpen(PETSC_COMM_WORLD,"daoutput",PETSC_FILE_RDONLY,&bviewer);
 24:   DALoad(bviewer,M,N,PETSC_DECIDE,&da);
 25:   DACreateGlobalVector(da,&global);
 26:   VecLoadIntoVector(bviewer,global);
 27:   PetscViewerDestroy(bviewer);


 30:   VecView(global,PETSC_VIEWER_DRAW_WORLD);


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