Actual source code: ex2.c
petsc-3.6.4 2016-04-12
2: static char help[] = "Demonstrates PetscOptionsGetViewer().\n\n";
4: #include <petscviewer.h>
8: int main(int argc,char **args)
9: {
10: PetscViewer viewer;
11: PetscErrorCode ierr;
12: PetscViewerFormat format;
14: PetscInitialize(&argc,&args,(char*)0,help);
15: PetscOptionsGetViewer(PETSC_COMM_WORLD,NULL,"-myviewer",&viewer,&format,NULL);
16: PetscViewerPushFormat(viewer,format);
17: PetscViewerView(viewer,PETSC_VIEWER_STDOUT_WORLD);
18: PetscViewerPopFormat(viewer);
19: PetscViewerDestroy(&viewer);
20: PetscFinalize();
21: return 0;
22: }