Actual source code: ex2.c

      2: static char help[] = "Demonstrates PetscOptionsGetViewer().\n\n";

      4: #include <petscviewer.h>

      6: int main(int argc,char **args)
      7: {
      8:   PetscViewer       viewer;
      9:   PetscViewerFormat format;

     11:   PetscInitialize(&argc,&args,(char*)0,help);
     12:   PetscOptionsGetViewer(PETSC_COMM_WORLD,NULL,NULL,"-myviewer",&viewer,&format,NULL);
     13:   PetscViewerPushFormat(viewer,format);
     14:   PetscViewerView(viewer,PETSC_VIEWER_STDOUT_WORLD);
     15:   PetscViewerPopFormat(viewer);
     16:   PetscViewerDestroy(&viewer);
     17:   PetscFinalize();
     18:   return 0;
     19: }

     21: /*TEST

     23:    test:
     24:       args: -myviewer ascii

     26:    testset:
     27:       args: -myviewer hdf5:my.hdf5:hdf5_xdmf
     28:       requires: hdf5
     29:       test:
     30:         suffix: 2a
     31:         args: -viewer_hdf5_base_dimension2 false -viewer_hdf5_sp_output true  -viewer_hdf5_collective false
     32:       test:
     33:         suffix: 2b
     34:         args: -viewer_hdf5_base_dimension2 true  -viewer_hdf5_sp_output false -viewer_hdf5_collective true

     36: TEST*/