ensure_scratch Subroutine

private subroutine ensure_scratch(need)

Grow polygon scratch epx, epy to hold at least need points.

Discards old contents when grown.

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: need

Number of points needed.


Source Code

   subroutine ensure_scratch(need)
      !! Grow polygon scratch `epx`, `epy` to hold at least `need` points.
      !!
      !! Discards old contents when grown.
      ! Arguments
      integer(int32), intent(in) :: need
         !! Number of points needed.
      if (allocated(epx)) then
         if (int(size(epx), int32) >= need) return
         deallocate (epx, epy)
      end if
      allocate (epx(need), epy(need))
   end subroutine ensure_scratch