#-----------------------------------------------------------------------
#     Copyright (C) 2000-2004 GFD Dennou Club. All rights reserved.
#-----------------------------------------------------------------------

require "numru/dcl"

include NumRu
include Math

raise "This program is for DCL 5.3 or later" unless DCL::DCLVERSION >= '5.3'

#  / SET PARAMETERS /

nx = 15
ny = 15
ux = NArray.sfloat(nx).indgen!/(nx-1)
uy = NArray.sfloat(ny).indgen!/(nx-1)
cx = NArray.sfloat(nx,ny)
cy = NArray.sfloat(nx,ny)
for j in 0...ny
  for i in 0...nx
    cx[i,j] = ux[i] + 0.1*uy[j]
    cy[i,j] = 0.2*ux[i] + uy[j]
  end
end

cxmin = 0.0
cxmax = 1.1
cymin = 0.0
cymax = 1.1

# / GRAPHIC /

iws = (ARGV[0] || (puts ' WORKSTATION ID (I)  ? ;'; DCL::sgpwsn; gets)).to_i
DCL::gropn(iws)
DCL::grfrm
DCL::grsvpt(0.15,0.85,0.15,0.85)
DCL::grswnd(ux[0],ux[-1],uy[0],uy[-1])
DCL::g2sctr(ux,uy,cx,cy)
DCL::grstrn(51)
DCL::sgscwd(cxmin,cxmax,cymin,cymax)
DCL::grstrf
DCL::sglset('LCLIP',true)

#  / TONE /

z = NArray.sfloat(nx,ny)
for j in 0...ny
  for i in 0...nx
    z[i,j] = ux[i] + uy[j]
  end
end

DCL::uelset('ltone',true)
DCL::uwsgxa(ux)
DCL::uwsgya(uy)
DCL::uetone(z)

#  / GRID LINES /

for j in 0...ny
  uyw = NArray.sfloat(nx).fill!(uy[j])
  DCL::sgplu(ux,uyw)
end

for i in 0...nx
  uxw = NArray.sfloat(ny).fill!(ux[i])
  DCL::sgplu(uxw,uy)
end

# / AXES (Switch to ITR==1) /

DCL::grswnd(cxmin,cxmax,cymin,cymax)
DCL::grstrn(1)
DCL::grstrf
DCL::usdaxs
DCL::uxsttl('t','BOTH X & Y TRANSFORMED',0.0)
DCL::grcls


syntax highlighted by Code2HTML, v. 0.9.1