Actual source code: ex4f.F90
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: #include <petsc/finclude/petscsys.h>
9: #include <petsc/finclude/petscdraw.h>
10: module ex4fmodule
11: use petscsys
12: use petscdraw
13: implicit none
14: contains
15: subroutine zoomfunction(draw, dummy, ierr)
17: PetscReal val
18: PetscInt, parameter :: max = 256
19: PetscDraw draw
20: integer dummy
21: PetscErrorCode, intent(out) :: ierr
22: PetscInt32 i
24: do i = 0, max - 1
25: val = real(i, PETSC_REAL_KIND)/real(max, PETSC_REAL_KIND)
26: PetscCall(PetscDrawLine(draw, 0.0_PETSC_REAL_KIND, val, 1.0_PETSC_REAL_KIND, val, i, ierr))
27: end do
28: ierr = 0
29: end
30: end module
31: program main
32: use petscsys
33: use petscdraw
34: use ex4fmodule
35: implicit none
37: PetscDraw draw
38: PetscErrorCode ierr
39: integer4, parameter :: x = 0, y = 0, width = 256, height = 256
41: PetscCallA(PetscInitialize(ierr))
42: PetscCallA(PetscDrawCreate(PETSC_COMM_WORLD, PETSC_NULL_CHARACTER, 'Title', x, y, width, height, draw, ierr))
43: PetscCallA(PetscDrawSetFromOptions(draw, ierr))
44: PetscCallA(PetscDrawZoom(draw, zoomfunction, PETSC_NULL_INTEGER, ierr))
45: PetscCallA(PetscDrawDestroy(draw, ierr))
46: PetscCallA(PetscFinalize(ierr))
47: end
49: !/*TEST
50: !
51: ! build:
52: ! requires: x
53: !
54: ! test:
55: ! output_file: output/empty.out
56: !
57: !TEST*/