Actual source code: ex19.c

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

      4: /*T
      5:    Concepts: introduction to PETSc;
      6:    Concepts: printing^in parallel
      7:    Processors: n
      8: T*/

     12: #include <petscsys.h>
     13: #include <petscviewer.h>
     14: int main(int argc,char **argv)
     15: {
     17:   PetscOptions   options;

     19:   PetscInitialize(&argc,&argv,(char*)0,help);if (ierr) return ierr;
     20:   CHKERRQ(PetscOptionsCreate(&options));
     21:   CHKERRQ(PetscOptionsInsert(options,&argc,&argv,"optionsfile"));
     22:   CHKERRQ(PetscOptionsInsertString(options,"-option1 value1 -option2 -option3 value3"));
     23:   CHKERRQ(PetscOptionsView(options,PETSC_VIEWER_STDOUT_WORLD));
     24:   CHKERRQ(PetscOptionsDestroy(&options));
     25:   PetscFinalize();
     26:   return ierr;
     27: }

     30: /*TEST

     32:    test:
     33:      localrunfiles: optionsfile
     34:      filter: egrep -v "(malloc|nox|display|saws_port|vecscatter|options_left|check_pointer_intensity|cuda_initialize|error_output_stdout|use_gpu_aware_mpi)"

     36: TEST*/