TUgridGrow TCL UTILITIES USER MANUAL TUgridGrow
SYNOPSIS
Expands the number of cells in a 2D data grid
PACKAGE
TCLUTILS
NAME
TUgridGrow
USAGE
TUgridGrow  iGrid igInfo oGrid ogInfo nX nY
INPUT DEFINITIONS
iGrid - The input 2D data grid generated by a call to TUdataGrid.
igInfo - The grid information array for the input data grid.
oGrid - The output expanded data grid
ogInfo - The grid information array for the output data grid.
nX - The number of columns of cells to add between each column of cells in the input grid. The value must be an odd integer.
nY - The number of rows of cells to add between each row of cells in the input grid. The value must be an odd integer.
RETURN DEFINITION
NONE
DESCRIPTION
TUgridGrow takes a 2D grid of data and expands the number of rows and columns by adding nX columns between each column in the input grid and rows and nY rows between each row in the input grid. Both nX and nY must be odd integers or zero. The modified grid is returned in oGrid and its grid information array in /ogInfo. The input and output grid information arrays are identical except for the grid size.
The added rows and columns in the output grid are filled with interpolated data generated during the expansion.
ERRORS
None Generated
C BACKING
No
EXAMPLE(S)
EXAMPLE 1:Expand the number of rows and columns in a grid of gaussian function.
# Grid grow example

# SET up a gaussian data set

set nP 0
for { set X -6.0 } { $X <= 6.0 } { set X [expr $X + .1] } {
   for { set Y -6.0 } { $Y <= 6.0 } { set Y [expr $Y + .1] } {
       set Xx($nP) $X
       set Yy($nP) $Y
       set R [expr $Xx($nP) * $Xx($nP) + $Yy($nP) * $Yy($nP)]
       set Vv($nP) [expr exp (-$R / 6.0)]
       incr nP
   }
}

# SET up the grid information array.  This is a coarse grid only 25 cells
#   on a side

set gInfo(0) -6.0
set gInfo(1) 6.0
set gInfo(2) -6.0
set gInfo(3) 6.0
set gInfo(4) 25
set gInfo(5) 25
set gInfo(6) POINT
set gInfo(7) POINT
set gInfo(8) COLUMN
set gInfo(9) IGNORE
set gInfo(10) NEW:ADD:END
set gInfo(11) -1
set gInfo(12) -5
set gInfo(13) -1.0e30
set gInfo(14)  1.0e30
set gInfo(15)  NO
set gInfo(16)  NO

# GRID the data set 

TUdataGrid $nP 1 Xx Xx 1 Yy Yy Vv Grid Norm gInfo

# SET up the plot basics.  There are a total of 3 plots defined here.

set GphInfo(xScrL) 400
set GphInfo(yScrL) 750
GraphicsOn TK ETones SWAP

GenWindow 1 0.0 0.0 0.0 1.0 1.0 0.0  0. 0. 0. 1. 1. 0. XY
set WinInfo(2,corFmt) 1
RelWindow 2 1 75.0 410.0 0. 375. 710. 0. -6. -6. 0. 6. 6. 0.
DefinePlot 2 2 $gInfo(4) $gInfo(5)
set WinInfo(3,corFmt) 1
RelWindow 3 1 75.0 80.0 0. 375. 380. 0. -6. -6. 0. 6. 6. 0.

# SET up the color map to run from 0 to 1.0

PLTcolorMap 0.0 1.0 LINEAR 0 cA

# PLOT the noiseless data set in upper left plot

Plot3D 2 Xb Yb Dummy Dummy Grid AUTO Dummy cA

# Increase the size of Grid by 3 empty grids between each row and column
#    and plot this new grid

TUgridGrow Grid gInfo nGrid ngInfo 3 3

DefinePlot 3 3 $ngInfo(4) $ngInfo(5)

Plot3D 3 Xb Yb Dummy Dummy nGrid AUTO Dummy cA

# THROW up the axis.  Only annotate lower left-hand  plot

PlotOutlines 2 [list "" 1.0 "" 1.0] [list NONE NONE BOTH BOTH]
PlotOutlines 3 [list "X" 1.0 "Y" 1.0] [list BOT BOT BOTH BOTH]
update

# LABEL the plots 

TextProp 12 HOLD HOLD
WinClip 2 0
TexT 2 0.0 6.50 0.0 center "ORIGINAL" $GphInfo(White)
WinClip 3 0
TexT 3 0.0 6.50 0.0 center "RESIZED" $GphInfo(White)
      
Sept 22, 2006