xref: /petsc/src/ts/tutorials/ex28.c (revision 63a3b9bc7a1f24f247904ccba9383635fe6abade)
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   PetscCall(PetscInitialize(&argc,&argv,NULL,help));
21   PetscCall(PetscDLLibraryAppend(PETSC_COMM_WORLD,&PetscDLLibrariesLoaded,"advection-diffusion-reaction/ex1"));
22   PetscCall(TSCreate(PETSC_COMM_WORLD,&ts));
23   PetscCall(PetscViewerBinaryOpen(PETSC_COMM_WORLD,"advection-diffusion-reaction/binaryoutput",FILE_MODE_READ,&viewer));
24   PetscCall(TSLoad(ts,viewer));
25   PetscCall(PetscViewerDestroy(&viewer));
26   /* PetscCall(PetscFPTView(0)); */
27   PetscCall(TSSetFromOptions(ts));
28   PetscCall(TSSetUp(ts));
29   PetscCall(TSView(ts,PETSC_VIEWER_STDOUT_WORLD));
30   PetscCall(TSSolve(ts,NULL));
31   PetscCall(TSDestroy(&ts));
32   PetscCall(PetscFinalize());
33   return 0;
34 }
35