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