Actual source code: ex23.c

petsc-3.13.6 2020-09-29
Report Typos and Errors

  2: static char help[] = "Tests string options with spaces";

  4:  #include <petscsys.h>

  6: int main(int argc,char **argv)
  7: {
  9:   PetscBool      ts_view       = PETSC_FALSE;
 10:   PetscInt       ts_max_steps  = 0, snes_max_it = 0;
 11:   PetscReal      ts_max_time = 0.;

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


 24: /*TEST
 25:    
 26:    test:
 27:       requires: yaml
 28:       args: -options_file_yaml ex23options
 29:       localrunfiles: ex23options

 31: TEST*/