1c4762a1bSJed Brown static char help[] = "Tests string options with spaces"; 2c4762a1bSJed Brown 3c4762a1bSJed Brown #include <petscsys.h> 4c4762a1bSJed Brown 5*d71ae5a4SJacob Faibussowitsch int main(int argc, char **argv) 6*d71ae5a4SJacob Faibussowitsch { 7c4762a1bSJed Brown PetscBool ts_view = PETSC_FALSE; 8c4762a1bSJed Brown PetscInt ts_max_steps = 0, snes_max_it = 0; 9c4762a1bSJed Brown PetscReal ts_max_time = 0.; 109fc438c3SToby Isaac PetscBool foo_view = PETSC_FALSE; 119fc438c3SToby Isaac PetscInt foo_max_steps = 0, bar_max_it = 0; 129fc438c3SToby Isaac PetscReal foo_max_time = 0.; 13c4762a1bSJed Brown 14327415f7SBarry Smith PetscFunctionBeginUser; 159566063dSJacob Faibussowitsch PetscCall(PetscInitialize(&argc, &argv, NULL, help)); 169566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetBool(NULL, 0, "-ts_view", &ts_view, NULL)); 179566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetReal(NULL, 0, "-ts_max_time", &ts_max_time, NULL)); 189566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetInt(NULL, 0, "-ts_max_steps", &ts_max_steps, NULL)); 199566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetBool(NULL, 0, "-foo_view", &foo_view, NULL)); 209566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetReal(NULL, 0, "-foo_max_time", &foo_max_time, NULL)); 219566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetInt(NULL, 0, "-foo_max_steps", &foo_max_steps, NULL)); 229566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetInt(NULL, 0, "-snes_max_it", &snes_max_it, NULL)); 239566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetInt(NULL, 0, "-bar_max_it", &bar_max_it, NULL)); 249566063dSJacob 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)); 259566063dSJacob 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