Actual source code: ex4f.F
petsc-3.12.4 2020-02-04
Report Typos and Errors

      1: !
      2: !
      3: !  This example demonstrates use of PetscDrawZoom()
      4: !
      5: !          This function is called repeatedly by PetscDrawZoom() to
      6: !      redraw the figure
      7: !
      8:       subroutine zoomfunction(draw,dummy,ierr)
      9:  #include <petsc/finclude/petscsys.h>
     10:  #include <petsc/finclude/petscdraw.h>
     11:       use petscsys
     12:       implicit none
     13:       PetscReal zero, one,value, max
     14:       PetscDraw    draw
     15:       integer dummy
     16:       PetscErrorCode ierr

     18:       PetscInt i

     20:       zero = 0
     21:       one  = 1
     22:       max = 256.0
     23:       do 10, i=0,255
     24:         value = i/max
     25:         call PetscDrawLine(draw,zero,value,one,value,i,ierr)
     26:  10   continue
     27:       return
     28:       end

     30:       program main
     31:       use petscsys
     32:       implicit none

     34:       PetscDraw draw
     35:       PetscErrorCode ierr
     36:       integer  x,y,width,height
     37:       External zoomfunction
     38:       x      = 0
     39:       y      = 0
     40:       width  = 256
     41:       height = 256

     43:       call PetscInitialize(PETSC_NULL_CHARACTER,ierr)
     44:       if (ierr .ne. 0) then
     45:         print*,'Unable to initialize PETSc'
     46:         stop
     47:       endif
     48:       call PetscDrawCreate(PETSC_COMM_WORLD,PETSC_NULL_CHARACTER,        &
     49:      & 'Title',x,y,width,height,draw,ierr)
     50:       call PetscDrawSetFromOptions(draw,ierr)
     51:       call PetscDrawZoom(draw,zoomfunction,PETSC_NULL_INTEGER,ierr)
     52:       call PetscDrawDestroy(draw,ierr)
     53:       call PetscFinalize(ierr)
     54:       end

     56: !/*TEST
     57: !
     58: !   build:
     59: !     requires: x
     60: !
     61: !   test:
     62: !     output_file: output/ex1_1.out
     63: !
     64: !TEST*/