1 2 static char help[] = "Demonstrates PetscOptionsGetViewer().\n\n"; 3 4 #include <petscviewer.h> 5 6 int main(int argc,char **args) 7 { 8 PetscViewer viewer; 9 PetscViewerFormat format; 10 11 PetscCall(PetscInitialize(&argc,&args,(char*)0,help)); 12 PetscCall(PetscOptionsGetViewer(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 } 20 21 /*TEST 22 23 test: 24 args: -myviewer ascii 25 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 35 36 TEST*/ 37