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