Date: 2022-03-04T17:36:59+00:00

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:   PetscErrorCode    ierr;
     10:   PetscViewerFormat format;

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

     22: /*TEST

     24:    test:
     25:       args: -myviewer ascii

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

     37: TEST*/