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.; 12*9fc438c3SToby Isaac PetscBool foo_view = PETSC_FALSE; 13*9fc438c3SToby Isaac PetscInt foo_max_steps = 0, bar_max_it = 0; 14*9fc438c3SToby Isaac PetscReal foo_max_time = 0.; 15c4762a1bSJed Brown 16c4762a1bSJed Brown ierr = PetscInitialize(&argc,&argv,NULL,help);if (ierr) return ierr; 17c4762a1bSJed Brown ierr = PetscOptionsGetBool(NULL,0,"-ts_view",&ts_view,NULL);CHKERRQ(ierr); 18c4762a1bSJed Brown ierr = PetscOptionsGetReal(NULL,0,"-ts_max_time",&ts_max_time,NULL);CHKERRQ(ierr); 19c4762a1bSJed Brown ierr = PetscOptionsGetInt(NULL,0,"-ts_max_steps",&ts_max_steps,NULL);CHKERRQ(ierr); 20*9fc438c3SToby Isaac ierr = PetscOptionsGetBool(NULL,0,"-foo_view",&foo_view,NULL);CHKERRQ(ierr); 21*9fc438c3SToby Isaac ierr = PetscOptionsGetReal(NULL,0,"-foo_max_time",&foo_max_time,NULL);CHKERRQ(ierr); 22*9fc438c3SToby Isaac ierr = PetscOptionsGetInt(NULL,0,"-foo_max_steps",&foo_max_steps,NULL);CHKERRQ(ierr); 23c4762a1bSJed Brown ierr = PetscOptionsGetInt(NULL,0,"-snes_max_it",&snes_max_it,NULL);CHKERRQ(ierr); 24*9fc438c3SToby Isaac ierr = PetscOptionsGetInt(NULL,0,"-bar_max_it",&bar_max_it,NULL);CHKERRQ(ierr); 25c4762a1bSJed Brown ierr = 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);CHKERRQ(ierr); 26c4762a1bSJed Brown ierr = PetscFinalize(); 27c4762a1bSJed Brown return ierr; 28c4762a1bSJed Brown } 29c4762a1bSJed Brown 30c4762a1bSJed Brown 31c4762a1bSJed Brown /*TEST 32c4762a1bSJed Brown 33c4762a1bSJed Brown test: 34c4762a1bSJed Brown requires: yaml 35c4762a1bSJed Brown args: -options_file_yaml ex23options 36c4762a1bSJed Brown localrunfiles: ex23options 37080f0011SToby Isaac 38080f0011SToby Isaac test: 39080f0011SToby Isaac suffix: string 40080f0011SToby Isaac requires: yaml 41080f0011SToby Isaac args: -options_string_yaml " 42*9fc438c3SToby Isaac foo: &foo 43080f0011SToby Isaac view: true 44*9fc438c3SToby Isaac max: &foomax 45*9fc438c3SToby Isaac steps: 3 46080f0011SToby Isaac time: 1.4 47*9fc438c3SToby Isaac bar: &bar 48*9fc438c3SToby Isaac max_it: 5 49*9fc438c3SToby Isaac ts: 50*9fc438c3SToby Isaac <<: *foo 51*9fc438c3SToby Isaac max: 52*9fc438c3SToby Isaac <<: *foomax 53*9fc438c3SToby Isaac steps: 10 54*9fc438c3SToby Isaac snes: *bar" 55c4762a1bSJed Brown 56c4762a1bSJed Brown TEST*/ 57