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