Actual source code: ex19.c

      1: static char help[] = "Illustrates creating an options database.\n\n";

      3: #include <petscsys.h>
      4: #include <petscviewer.h>
      5: int main(int argc, char **argv)
      6: {
      7:   PetscOptions options;

      9:   PetscFunctionBeginUser;
     10:   PetscCall(PetscInitialize(&argc, &argv, NULL, help));
     11:   PetscCall(PetscOptionsCreate(&options));
     12:   PetscCall(PetscOptionsInsert(options, &argc, &argv, "optionsfile"));
     13:   PetscCall(PetscOptionsInsertString(options, "-option1 value1 -option2 -option3 value3"));
     14:   PetscCall(PetscOptionsView(options, PETSC_VIEWER_STDOUT_WORLD));
     15:   PetscCall(PetscOptionsDestroy(&options));
     16:   PetscCall(PetscFinalize());
     17:   return 0;
     18: }

     20: /*TEST

     22:    test:
     23:      localrunfiles: optionsfile

     25: TEST*/