xref: /petsc/src/ts/tutorials/ex28.c (revision b122ec5aa1bd4469eb4e0673542fb7de3f411254)
1 
2 static char help[] ="Loads a previously saved TS.";
3 
4 /*
5    It loads a TS saved with TSView()
6 
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>
14 
15 int main(int argc,char **argv)
16 {
17   TS             ts;                 /* timestepping context */
18   PetscViewer    viewer;
19 
20   CHKERRQ(PetscInitialize(&argc,&argv,NULL,help));
21   CHKERRQ(PetscDLLibraryAppend(PETSC_COMM_WORLD,&PetscDLLibrariesLoaded,"advection-diffusion-reaction/ex1"));
22   CHKERRQ(TSCreate(PETSC_COMM_WORLD,&ts));
23   CHKERRQ(PetscViewerBinaryOpen(PETSC_COMM_WORLD,"advection-diffusion-reaction/binaryoutput",FILE_MODE_READ,&viewer));
24   CHKERRQ(TSLoad(ts,viewer));
25   CHKERRQ(PetscViewerDestroy(&viewer));
26   /* CHKERRQ(PetscFPTView(0)); */
27   CHKERRQ(TSSetFromOptions(ts));
28   CHKERRQ(TSSetUp(ts));
29   CHKERRQ(TSView(ts,PETSC_VIEWER_STDOUT_WORLD));
30   CHKERRQ(TSSolve(ts,NULL));
31   CHKERRQ(TSDestroy(&ts));
32   CHKERRQ(PetscFinalize());
33   return 0;
34 }
35