Actual source code: ex28.c


  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>

 15: int main(int argc,char **argv)
 16: {
 17:   TS             ts;                 /* timestepping context */
 19:   PetscViewer    viewer;

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