Actual source code: ex19.c

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

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

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

 19: /*TEST

 21:    test:
 22:      localrunfiles: optionsfile

 24: TEST*/