TUgridRowCol TCL UTILITIES USER MANUAL TUdgridRowCol
SYNOPSIS
Get or replace data in a grid row or column.
PACKAGE
TCLUTILS
NAME
TUgridRowCol
USAGE
set rV  TUgridRowCol  Grid gInfo V Action RC rcN {ReInit} {ReBad} {Expand}
INPUT DEFINITIONS
Grid - The input data grid.
gInfo - The grid information array.
V - The return data set if Action is RETRIEVE or the input data set if Action is STORE.
Action - This is set to RETRIEVE if a data from a grid row or column is being returned and STORE if the data in V is to be placed in one of the grid rows or columns.
RC - This is ROW if getting or replacing a row of data and COLUMN if getting or replacing a column data.
rcN - The grid row or column number being retrieved or replaced.
ReInit - An optional input valued defaulted to NO. The variable only has application when retrieving data. Set the variable to a numerical value if you want all of the cells in the returned row or column of data which are currently set to the grid initialization value given in gInfo(11) to be reset to the value passed in.
ReBad - An optional input valued defaulted to NO. The variable only has application when retrieving data. Set the variable to a numerical value if you want all of the cells in the returned row or column of data which are currently set to the grid bad value given in gInfo(12) to be reset to the value passed in.
Expand - An optional input valued defaulted to NO. The variable only has application when retrieving data. Set the variable to a numerical value the returned row or column of data padded out to a length of 2N. The padded elements are set to the passed in value. This is used generally when the data is being passed into an FFT.
RETURN DEFINITION
Returns the length of the returned array V when retrieving data and the number values replaced when storing data.
DESCRIPTION
TUgridRowCol can either retrieve or replace data a row or column of data in a grid. V either contains the retrieved data or holds that data that is to be placed in the grid. When retrieving data, values which are set to either the grid initialization or have been flagged as bad can be replaced with user supplied values. The array can also be padded out to a length of 2N with a user input value.
ERRORS
None Generated
C BACKING
No
EXAMPLE(S)
EXAMPLE 1:PLOT multiple rows of data through a grid.
# PLOT rows of data through a grid

# SET up a data set consisting of two Gaussians

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 Yy($nP) $Y
       set Xx($nP) $X
       set rA [expr ($X - 3.0) * ($X - 3.0) + $Yy($nP) * $Yy($nP)]
       set rB [expr ($X + 3.0) * ($X + 3.0) + $Yy($nP) * $Yy($nP)]
       set Vv($nP) [expr 2.0 * exp(-$rA / 8.0) + 1.5 * exp(-$rB / 8.0)]
       incr nP
   }
}

# SET up the grid information array. 

set gInfo(0) -6.0
set gInfo(1) 6.0
set gInfo(2) -6.0
set gInfo(3) 6.0
set gInfo(4) 100
set gInfo(5) 100
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

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

# TURN on plotting

set GphInfo(xScrL) 500
set GphInfo(yScrL) 800

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(8,corFmt) 1
RelWindow 8 1 75.0 375.0 0. 475. 775. 0. -6. -6. 0. 6. 6. 0.
DefinePlot 8 8 $gInfo(4) $gInfo(5)
set WinInfo(9,corFmt) 1
RelWindow 9 1 75.0 75.0 0. 475. 275. 0. -6. 0. 0. 6. 2. 0.
DefinePlot 9 9 -1 -1

# COLOR runs from 0 to 2.0

PLTcolorMap 0.0 2.0 LINEAR 0 cA

# PLOT the Grid

Plot3D 8 Xb Yb Dummy Dummy Grid AUTO Dummy cA
PlotOutlines 8 [list "X" 1.0 "Y" 1.0] [list BOT BOT BOTH BOTH]

# GET the X centers of a row of cells.

TUgridInfo 32 gInfo Xc 

# PLOT all cell rows from 0 to 50 incrementing by 5 rows.

for { set I 0 } { $I <= 50 } { incr I 5 } {
   set nE [expr [TUgridRowCol Grid gInfo Vc RETRIEVE ROW $I] - 1]
   Plot2D 9 Xb Yb Xc Vc 0 $nE  LINE [list $GphInfo(White) NONE]
}

# PLOT axis and labels

PlotOutlines 9 [list "X " 1.0 "V" 1.0] [list BOT BOT BOTH BOTH]
update
      
Sept 20, 2006