grid_strip Subroutine

private subroutine grid_strip(xa, xb, c, dyw)

Draw cell faces of one strip as zig-zag polyline.

Runs across world x [xa, xb] through faces in c inside view, skipping faces within dyw of last kept.

Arguments

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

Left strip edge, in world coords.

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

Right strip edge, in world coords.

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

Cell faces in cgs, centre to surface.

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

Smallest face spacing drawn, in world y units.


Source Code

   subroutine grid_strip(xa, xb, c, dyw)
      !! Draw cell faces of one strip as zig-zag polyline.
      !!
      !! Runs across world x [xa, xb] through faces in `c` inside view, skipping faces within `dyw`
      !! of last kept.
      ! Arguments
      real(real64), intent(in) :: xa
         !! Left strip edge, in world coords.
      real(real64), intent(in) :: xb
         !! Right strip edge, in world coords.
      real(real64), intent(in) :: c(:)
         !! Cell faces in cgs, centre to surface.
      real(real64), intent(in) :: dyw
         !! Smallest face spacing drawn, in world y units.
      real(real64) :: y, ylast, xl, xr
      integer(int32) :: j, j0, j1, n

      j0 = max(1_int32, bisect_le(c, min(st%ymin, st%ymax)*yscale()))
      j1 = min(int(size(c), int32), bisect_le(c, max(st%ymin, st%ymax)*yscale()) + 1_int32)
      call ensure_scratch(2*(j1 - j0 + 1))
      xl = clampx(xa); xr = clampx(xb)
      n = 0
      ylast = -huge(1.d0)
      do j = j0, j1
         y = ytrans(c(j))
         if (y - ylast < dyw .and. j < j1) cycle
         ylast = y
         if (mod(n/2, 2) == 0) then
            epx(n + 1) = xl; epx(n + 2) = xr
         else
            epx(n + 1) = xr; epx(n + 2) = xl
         end if
         epy(n + 1:n + 2) = clampy(y)
         n = n + 2
      end do
      if (n >= 2) call giza_line(n, epx(1:n), epy(1:n))
   end subroutine grid_strip