1c4762a1bSJed Brown 2c4762a1bSJed Brown static char help[] = "Tests string options with spaces"; 3c4762a1bSJed Brown 4c4762a1bSJed Brown #include <petscsys.h> 5c4762a1bSJed Brown 6*d71ae5a4SJacob Faibussowitsch int main(int argc, char **argv) 7*d71ae5a4SJacob Faibussowitsch { 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 15327415f7SBarry Smith PetscFunctionBeginUser; 169566063dSJacob Faibussowitsch PetscCall(PetscInitialize(&argc, &argv, NULL, help)); 179566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetBool(NULL, 0, "-ts_view", &ts_view, NULL)); 189566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetReal(NULL, 0, "-ts_max_time", &ts_max_time, NULL)); 199566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetInt(NULL, 0, "-ts_max_steps", &ts_max_steps, NULL)); 209566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetBool(NULL, 0, "-foo_view", &foo_view, NULL)); 219566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetReal(NULL, 0, "-foo_max_time", &foo_max_time, NULL)); 229566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetInt(NULL, 0, "-foo_max_steps", &foo_max_steps, NULL)); 239566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetInt(NULL, 0, "-snes_max_it", &snes_max_it, NULL)); 249566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetInt(NULL, 0, "-bar_max_it", &bar_max_it, NULL)); 259566063dSJacob 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)); 269566063dSJacob Faibussowitsch PetscCall(PetscFinalize()); 27b122ec5aSJacob Faibussowitsch return 0; 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