Actual source code: ex4.c


  2: static char help[] = "Demonstrates use of PetscDrawZoom()\n";

  4: #if defined(PETSC_APPLE_FRAMEWORK)

  6:   #include <PETSc/petscsys.h>
  7:   #include <PETSc/petscdraw.h>
  8: #else
  9: #include <petscsys.h>
 10: #include <petscdraw.h>
 11: #endif

 13: PetscErrorCode zoomfunction(PetscDraw draw, void *dummy)
 14: {
 15:   int         i;
 16:   MPI_Comm    comm = PetscObjectComm((PetscObject)draw);
 17:   PetscMPIInt size, rank;

 19:   MPI_Comm_size(comm, &size);
 20:   MPI_Comm_rank(comm, &rank);
 21:   for (i = rank; i < 256; i += size) {
 22:     PetscReal y = ((PetscReal)i) / (256 - 1);
 23:     PetscDrawLine(draw, 0.0, y, 1.0, y, i);
 24:   }
 25:   return 0;
 26: }

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

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

 43: /*TEST

 45:    build:
 46:      requires: x

 48:    test:
 49:      output_file: output/ex1_1.out

 51:    test:
 52:      suffix: db
 53:      args: -draw_double_buffer 0
 54:      output_file: output/ex1_1.out

 56:    test:
 57:      suffix: df
 58:      args: -draw_fast
 59:      output_file: output/ex1_1.out

 61:    test:
 62:      suffix: dv
 63:      args: -draw_virtual
 64:      output_file: output/ex1_1.out

 66: TEST*/