Actual source code: ex2.c
petsc-3.10.5 2019-03-28
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,"-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: TEST*/