Actual source code: ex23.c
petsc-3.14.6 2021-03-30
2: static char help[] = "Tests string options with spaces";
4: #include <petscsys.h>
6: int main(int argc,char **argv)
7: {
9: PetscBool ts_view = PETSC_FALSE;
10: PetscInt ts_max_steps = 0, snes_max_it = 0;
11: PetscReal ts_max_time = 0.;
12: PetscBool foo_view = PETSC_FALSE;
13: PetscInt foo_max_steps = 0, bar_max_it = 0;
14: PetscReal foo_max_time = 0.;
16: PetscInitialize(&argc,&argv,NULL,help);if (ierr) return ierr;
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 = %i\n-snes_max_it = %i\n",ts_view ? "true" : "false",ts_max_time,ts_max_steps,snes_max_it);
26: PetscFinalize();
27: return ierr;
28: }
31: /*TEST
33: test:
34: requires: yaml
35: args: -options_file_yaml ex23options
36: localrunfiles: ex23options
38: test:
39: suffix: string
40: requires: yaml
41: args: -options_string_yaml "
42: foo: &foo
43: view: true
44: max: &foomax
45: steps: 3
46: time: 1.4
47: bar: &bar
48: max_it: 5
49: ts:
50: <<: *foo
51: max:
52: <<: *foomax
53: steps: 10
54: snes: *bar"
56: TEST*/