Actual source code: ex2.c

petsc-3.5.4 2015-05-23
Report Typos and Errors
  2: static char help[] = "Demonstrates use of color map\n";

  4: #include <petscsys.h>
  5: #include <petscdraw.h>

  9: int main(int argc,char **argv)
 10: {
 11:   PetscDraw      draw;
 13:   int            x = 0,y = 0,width = 256,height = 256,i;

 15:   PetscInitialize(&argc,&argv,(char*)0,help);

 17:   PetscDrawCreate(PETSC_COMM_SELF,0,"Title",x,y,width,height,&draw);
 18:   PetscDrawSetFromOptions(draw);
 19:   for (i=0; i<256; i++) {
 20:     PetscDrawLine(draw,0.0,((PetscReal)i)/256.,1.0,((PetscReal)i)/256.,i);
 21:   }
 22:   PetscDrawFlush(draw);
 23:   PetscDrawDestroy(&draw);
 24:   PetscFinalize();
 25:   return 0;
 26: }