xref: /petsc/src/sys/tutorials/ex19.c (revision 697336901c45ac77e1fd620fe1fca906cf3f95c8)
1 
2 static char help[] = "Illustrates creating an options database.\n\n";
3 
4 #include <petscsys.h>
5 #include <petscviewer.h>
6 int main(int argc, char **argv)
7 {
8   PetscOptions options;
9 
10   PetscFunctionBeginUser;
11   PetscCall(PetscInitialize(&argc, &argv, (char *)0, help));
12   PetscCall(PetscOptionsCreate(&options));
13   PetscCall(PetscOptionsInsert(options, &argc, &argv, "optionsfile"));
14   PetscCall(PetscOptionsInsertString(options, "-option1 value1 -option2 -option3 value3"));
15   PetscCall(PetscOptionsView(options, PETSC_VIEWER_STDOUT_WORLD));
16   PetscCall(PetscOptionsDestroy(&options));
17   PetscCall(PetscFinalize());
18   return 0;
19 }
20 
21 /*TEST
22 
23    test:
24      localrunfiles: optionsfile
25 
26 TEST*/
27