2: static char help[] = "Illustrates creating an options database.\n\n"; 4: #include <petscsys.h> 5: #include <petscviewer.h> 6: int main(int argc, char **argv) 7: { 8: PetscOptions options; 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: } 21: /*TEST 23: test: 24: localrunfiles: optionsfile 25: filter: grep -E -v "(options_left)" 27: TEST*/