draw_grid Subroutine

private subroutine draw_grid(wx1, wx2, wy1, wy2)

Draw cell and time-boundary grid over visible range.

Strips narrower than a device pixel merge into next drawn one (which shows that model's faces) and faces within a pixel of last kept are skipped, so cost follows window size, not file. Only when st%showgrid is set.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: wx1

Left window edge, in world coords.

real(kind=real64), intent(in) :: wx2

Right window edge, in world coords.

real(kind=real64), intent(in) :: wy1

Bottom window edge, in world coords.

real(kind=real64), intent(in) :: wy2

Top window edge, in world coords.


Source Code

   subroutine draw_grid(wx1, wx2, wy1, wy2)
      !! Draw cell and time-boundary grid over visible range.
      !!
      !! Strips narrower than a device pixel merge into next drawn one (which shows that model's
      !! faces) and faces within a pixel of last kept are skipped, so cost follows window size, not
      !! file. Only when `st%showgrid` is set.
      ! Arguments
      real(real64), intent(in) :: wx1
         !! Left window edge, in world coords.
      real(real64), intent(in) :: wx2
         !! Right window edge, in world coords.
      real(real64), intent(in) :: wy1
         !! Bottom window edge, in world coords.
      real(real64), intent(in) :: wy2
         !! Top window edge, in world coords.
      real(real64) :: px1, px2, py1, py2, dxw, dyw, xa, xb
      integer(int32) :: i
      logical, save :: noted = .false.

      if (.not. st%showgrid) return
      if (cnv_loaded .and. .not. noted) then
         print '(a)', '[kipp] grid: a KEPLER .cnv stores a reduced set of grid points, not every zone'
         noted = .true.
      end if
      call giza_get_viewport(3_c_int, px1, px2, py1, py2)
      dxw = abs(wx2 - wx1)/max(abs(px2 - px1), 1.d0)
      dyw = abs(wy2 - wy1)/max(abs(py2 - py1), 1.d0)
      call giza_set_colour_representation(7, 0.5d0, 0.5d0, 0.5d0)
      call giza_set_colour_index(7)
      call giza_set_line_width(1.d0)
      xa = xtrans(xedge(ivis0))
      call grid_edge(xa, ivis0, ivis0)
      do i = ivis0, ivis1
         xb = xtrans(xedge(i + 1))
         if (xb - xa < dxw .and. i < ivis1) cycle
         if (st%yaxis == 'radius') then
            call grid_strip(xa, xb, data(i)%rncoord, dyw)
         else
            call grid_strip(xa, xb, data(i)%xmcoord, dyw)
         end if
         call grid_edge(xb, i, min(i + 1, nmodels))
         xa = xb
      end do
   end subroutine draw_grid