Actual source code: ex23.c

petsc-3.7.3 2016-08-01
Report Typos and Errors
  2: static char help[] = "Tests string options with spaces";

  4: #include <petscsys.h>

  8: int main(int argc,char **argv)
  9: {
 11:   PetscBool      ts_view       = PETSC_FALSE;
 12:   PetscInt       ts_max_steps  = 0, snes_max_steps = 0;
 13:   PetscReal      ts_final_time = 0.;

 15:   PetscInitialize(&argc,&argv,NULL,help);
 16:   PetscOptionsGetBool(NULL,0,"-ts_view",&ts_view,NULL);
 17:   PetscOptionsGetReal(NULL,0,"-ts_final_time",&ts_final_time,NULL);
 18:   PetscOptionsGetInt(NULL,0,"-ts_max_steps",&ts_max_steps,NULL);
 19:   PetscOptionsGetInt(NULL,0,"-snes_max_steps",&snes_max_steps,NULL);
 20:   PetscPrintf(PETSC_COMM_WORLD,"-ts_view = %s\n-ts_final_time = %f\n-ts_max_steps = %i\n-snes_max_steps = %i\n",ts_view ? "true" : "false",ts_final_time,ts_max_steps,snes_max_steps);
 21:   PetscFinalize();
 22:   return 0;
 23: }