Actual source code: ex2.c

petsc-master 2017-04-28
Report Typos and Errors

  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: }