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 PetscCall(PetscInitialize(&argc,&argv,(char*)0,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 filter: egrep -v "(options_left)" 25 26 TEST*/ 27