Actual source code: ex4.c

petsc-3.6.1 2015-08-06
Report Typos and Errors
  2: static char help[] = "Demonstrates use of PetscDrawZoom()\n";

  4: #if defined(PETSC_APPLE_FRAMEWORK)
  5: #include <PETSc/petscsys.h>
  6: #include <PETSc/petscdraw.h>
  7: #else
  8: #include <petscsys.h>
  9: #include <petscdraw.h>
 10: #endif

 14: PetscErrorCode zoomfunction(PetscDraw draw,void *dummy)
 15: {
 17:   int            i;

 19:   for (i=0; i<256; i++) {
 20:     PetscDrawLine(draw,0.0,((PetscReal)i)/256.,1.0,((PetscReal)i)/256.,i);
 21:   }
 22:   return 0;
 23: }

 27: int main(int argc,char **argv)
 28: {
 29:   PetscDraw      draw;
 30:   int            x = 0,y = 0,width = 256,height = 256;

 33:   PetscInitialize(&argc,&argv,(char*)0,help);
 34:   PetscDrawCreate(PETSC_COMM_SELF,0,"Title",x,y,width,height,&draw);
 35:   PetscDrawSetFromOptions(draw);
 36:   PetscDrawZoom(draw,zoomfunction,NULL);
 37:   PetscDrawDestroy(&draw);
 38:   PetscFinalize();
 39:   return 0;
 40: }