Actual source code: ex2.c

  1: static char help[] = "Demonstrates PetscOptionsCreateViewer().\n\n";

  3: #include <petscviewer.h>

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

 10:   PetscFunctionBeginUser;
 11:   PetscCall(PetscInitialize(&argc, &args, NULL, help));
 12:   PetscCall(PetscOptionsCreateViewer(PETSC_COMM_WORLD, NULL, NULL, "-myviewer", &viewer, &format, NULL));
 13:   PetscCall(PetscViewerPushFormat(viewer, format));
 14:   PetscCall(PetscViewerView(viewer, PETSC_VIEWER_STDOUT_WORLD));
 15:   PetscCall(PetscViewerPopFormat(viewer));
 16:   PetscCall(PetscViewerDestroy(&viewer));
 17:   PetscCall(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*/