Actual source code: ex28.c

petsc-3.5.4 2015-05-23
Report Typos and Errors
  2: static char help[] ="Loads a previously saved TS.";

  4: /*
  5:    It loads a TS saved with TSView()

  7: */
  8: /*
  9:     Include "petscts.h" to use the PETSc timestepping routines. Note that
 10:     this file automatically includes "petscsys.h" and other lower-level
 11:     PETSc include files.
 12: */
 13: #include <petscts.h>


 18: int main(int argc,char **argv)
 19: {
 20:   TS             ts;                 /* timestepping context */
 22:   PetscViewer    viewer;

 24:   PetscInitialize(&argc,&argv,NULL,help);
 25:   PetscDLLibraryAppend(PETSC_COMM_WORLD,&PetscDLLibrariesLoaded,"advection-diffusion-reaction/ex1");
 26:   TSCreate(PETSC_COMM_WORLD,&ts);
 27:   PetscViewerBinaryOpen(PETSC_COMM_WORLD,"advection-diffusion-reaction/binaryoutput",FILE_MODE_READ,&viewer);
 28:   TSLoad(ts,viewer);
 29:   PetscViewerDestroy(&viewer);
 30:   /* PetscFPTView(0); */
 31:   TSSetFromOptions(ts);
 32:   TSSetUp(ts);
 33:   TSView(ts,PETSC_VIEWER_STDOUT_WORLD);
 34:   TSSolve(ts,NULL);
 35:   TSDestroy(&ts);
 36:   PetscFinalize();

 38:   return 0;
 39: }