1c4762a1bSJed Brown 2c4762a1bSJed Brown static char help[] = "Tests string options with spaces"; 3c4762a1bSJed Brown 4c4762a1bSJed Brown #include <petscsys.h> 5c4762a1bSJed Brown 6c4762a1bSJed Brown int main(int argc,char **argv) 7c4762a1bSJed Brown { 8c4762a1bSJed Brown PetscBool ts_view = PETSC_FALSE; 9c4762a1bSJed Brown PetscInt ts_max_steps = 0, snes_max_it = 0; 10c4762a1bSJed Brown PetscReal ts_max_time = 0.; 119fc438c3SToby Isaac PetscBool foo_view = PETSC_FALSE; 129fc438c3SToby Isaac PetscInt foo_max_steps = 0, bar_max_it = 0; 139fc438c3SToby Isaac PetscReal foo_max_time = 0.; 14c4762a1bSJed Brown 15*9566063dSJacob Faibussowitsch PetscCall(PetscInitialize(&argc,&argv,NULL,help)); 16*9566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetBool(NULL,0,"-ts_view",&ts_view,NULL)); 17*9566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetReal(NULL,0,"-ts_max_time",&ts_max_time,NULL)); 18*9566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetInt(NULL,0,"-ts_max_steps",&ts_max_steps,NULL)); 19*9566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetBool(NULL,0,"-foo_view",&foo_view,NULL)); 20*9566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetReal(NULL,0,"-foo_max_time",&foo_max_time,NULL)); 21*9566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetInt(NULL,0,"-foo_max_steps",&foo_max_steps,NULL)); 22*9566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetInt(NULL,0,"-snes_max_it",&snes_max_it,NULL)); 23*9566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetInt(NULL,0,"-bar_max_it",&bar_max_it,NULL)); 24*9566063dSJacob Faibussowitsch PetscCall(PetscPrintf(PETSC_COMM_WORLD,"-ts_view = %s\n-ts_max_time = %f\n-ts_max_steps = %" PetscInt_FMT "\n-snes_max_it = %" PetscInt_FMT "\n",ts_view ? "true" : "false",(double)ts_max_time,ts_max_steps,snes_max_it)); 25*9566063dSJacob Faibussowitsch PetscCall(PetscFinalize()); 26b122ec5aSJacob Faibussowitsch return 0; 27c4762a1bSJed Brown } 28c4762a1bSJed Brown 29c4762a1bSJed Brown /*TEST 30c4762a1bSJed Brown 31c4762a1bSJed Brown test: 32c4762a1bSJed Brown args: -options_file_yaml ex23options 33c4762a1bSJed Brown localrunfiles: ex23options 34080f0011SToby Isaac 35080f0011SToby Isaac test: 36080f0011SToby Isaac suffix: string 37080f0011SToby Isaac args: -options_string_yaml " 389fc438c3SToby Isaac foo: &foo 39080f0011SToby Isaac view: true 409fc438c3SToby Isaac max: &foomax 419fc438c3SToby Isaac steps: 3 42080f0011SToby Isaac time: 1.4 439fc438c3SToby Isaac bar: &bar 449fc438c3SToby Isaac max_it: 5 459fc438c3SToby Isaac ts: 469fc438c3SToby Isaac <<: *foo 479fc438c3SToby Isaac max: 489fc438c3SToby Isaac <<: *foomax 499fc438c3SToby Isaac steps: 10 509fc438c3SToby Isaac snes: *bar" 51c4762a1bSJed Brown 52c4762a1bSJed Brown TEST*/ 53