Actual source code: ex23.c
2: static char help[] = "Tests string options with spaces";
4: #include <petscsys.h>
6: int main(int argc, char **argv)
7: {
8: PetscBool ts_view = PETSC_FALSE;
9: PetscInt ts_max_steps = 0, snes_max_it = 0;
10: PetscReal ts_max_time = 0.;
11: PetscBool foo_view = PETSC_FALSE;
12: PetscInt foo_max_steps = 0, bar_max_it = 0;
13: PetscReal foo_max_time = 0.;
16: PetscInitialize(&argc, &argv, NULL, help);
17: PetscOptionsGetBool(NULL, 0, "-ts_view", &ts_view, NULL);
18: PetscOptionsGetReal(NULL, 0, "-ts_max_time", &ts_max_time, NULL);
19: PetscOptionsGetInt(NULL, 0, "-ts_max_steps", &ts_max_steps, NULL);
20: PetscOptionsGetBool(NULL, 0, "-foo_view", &foo_view, NULL);
21: PetscOptionsGetReal(NULL, 0, "-foo_max_time", &foo_max_time, NULL);
22: PetscOptionsGetInt(NULL, 0, "-foo_max_steps", &foo_max_steps, NULL);
23: PetscOptionsGetInt(NULL, 0, "-snes_max_it", &snes_max_it, NULL);
24: PetscOptionsGetInt(NULL, 0, "-bar_max_it", &bar_max_it, NULL);
25: 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);
26: PetscFinalize();
27: return 0;
28: }
30: /*TEST
32: test:
33: args: -options_file_yaml ex23options
34: localrunfiles: ex23options
36: test:
37: suffix: string
38: args: -options_string_yaml "
39: foo: &foo
40: view: true
41: max: &foomax
42: steps: 3
43: time: 1.4
44: bar: &bar
45: max_it: 5
46: ts:
47: <<: *foo
48: max:
49: <<: *foomax
50: steps: 10
51: snes: *bar"
53: TEST*/