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 PetscErrorCode ierr; 9c4762a1bSJed Brown PetscBool ts_view = PETSC_FALSE; 10c4762a1bSJed Brown PetscInt ts_max_steps = 0, snes_max_it = 0; 11c4762a1bSJed Brown PetscReal ts_max_time = 0.; 129fc438c3SToby Isaac PetscBool foo_view = PETSC_FALSE; 139fc438c3SToby Isaac PetscInt foo_max_steps = 0, bar_max_it = 0; 149fc438c3SToby Isaac PetscReal foo_max_time = 0.; 15c4762a1bSJed Brown 16c4762a1bSJed Brown ierr = PetscInitialize(&argc,&argv,NULL,help);if (ierr) return ierr; 17*5f80ce2aSJacob Faibussowitsch CHKERRQ(PetscOptionsGetBool(NULL,0,"-ts_view",&ts_view,NULL)); 18*5f80ce2aSJacob Faibussowitsch CHKERRQ(PetscOptionsGetReal(NULL,0,"-ts_max_time",&ts_max_time,NULL)); 19*5f80ce2aSJacob Faibussowitsch CHKERRQ(PetscOptionsGetInt(NULL,0,"-ts_max_steps",&ts_max_steps,NULL)); 20*5f80ce2aSJacob Faibussowitsch CHKERRQ(PetscOptionsGetBool(NULL,0,"-foo_view",&foo_view,NULL)); 21*5f80ce2aSJacob Faibussowitsch CHKERRQ(PetscOptionsGetReal(NULL,0,"-foo_max_time",&foo_max_time,NULL)); 22*5f80ce2aSJacob Faibussowitsch CHKERRQ(PetscOptionsGetInt(NULL,0,"-foo_max_steps",&foo_max_steps,NULL)); 23*5f80ce2aSJacob Faibussowitsch CHKERRQ(PetscOptionsGetInt(NULL,0,"-snes_max_it",&snes_max_it,NULL)); 24*5f80ce2aSJacob Faibussowitsch CHKERRQ(PetscOptionsGetInt(NULL,0,"-bar_max_it",&bar_max_it,NULL)); 25*5f80ce2aSJacob Faibussowitsch CHKERRQ(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)); 26c4762a1bSJed Brown ierr = PetscFinalize(); 27c4762a1bSJed Brown return ierr; 28c4762a1bSJed Brown } 29c4762a1bSJed Brown 30c4762a1bSJed Brown /*TEST 31c4762a1bSJed Brown 32c4762a1bSJed Brown test: 33c4762a1bSJed Brown args: -options_file_yaml ex23options 34c4762a1bSJed Brown localrunfiles: ex23options 35080f0011SToby Isaac 36080f0011SToby Isaac test: 37080f0011SToby Isaac suffix: string 38080f0011SToby Isaac args: -options_string_yaml " 399fc438c3SToby Isaac foo: &foo 40080f0011SToby Isaac view: true 419fc438c3SToby Isaac max: &foomax 429fc438c3SToby Isaac steps: 3 43080f0011SToby Isaac time: 1.4 449fc438c3SToby Isaac bar: &bar 459fc438c3SToby Isaac max_it: 5 469fc438c3SToby Isaac ts: 479fc438c3SToby Isaac <<: *foo 489fc438c3SToby Isaac max: 499fc438c3SToby Isaac <<: *foomax 509fc438c3SToby Isaac steps: 10 519fc438c3SToby Isaac snes: *bar" 52c4762a1bSJed Brown 53c4762a1bSJed Brown TEST*/ 54