| TUgridFill1D | TCL UTILITIES USER MANUAL | TUgridFill1D |
|---|
| TUgridFill1D  |
Grid
gInfo
|
| Grid | - | A 1D data grid generated through a call to TUdataGrid. | ||||||||||||
| gInfo | - | The grid information array. | ||||||||||||
| Dir | - | The fill direction which must be X or Y. | ||||||||||||
| FmT | - | The method used to fill the gaps. If
V1 is the value at the leading edge of a gap and V2 the value
at the closing edge then the methods are:
|
||||||||||||
| mGap | - | An optional value defaulted to -1 which specified a maximum gap size. If this value is >= 0 then gaps greater than this size will not be filled. Size has units of grid cells. | ||||||||||||
| Expand | - | An optional value defaulted to 0. If this value is 0 gaps at the beginning and end of the grid will not be filled. If set to 1 the gaps will be filled using the first and last values in the grid. | ||||||||||||
| gNorm | - | Optional input. This is the normalization array returned with the Grid> array from TUdataGrid. If provided the routine can absolutely identify empty grid cells, otherwise it makes its best guess were gaps exist. |
| NONE |
# FILL gaps in a 1D grid
# CREATE a sparse synthetic data set to the function:
# Y = A*X^3 + B*X^2 + C*X + D
set A .5
set B -1.0
set C -2.0
set D 8.0
set nP 0
for { set I -3.0 } { $I <= 4.0 } { set I [expr $I + 0.5] } {
set Xs [expr $I * $I]
set X($nP) $I
set V($nP) [expr $A * $Xs * $I + $B * $Xs + $C * $I + $D]
incr nP
}
# SET up the grid information array. Grid is in X direction so set the
# Y direction to a range -1.0 t0 1.0 over 1 grid
set gInfo(0) -3.00
set gInfo(1) 4.001
set gInfo(2) -1.0
set gInfo(3) 1.0
set gInfo(4) 500
set gInfo(5) 1
set gInfo(6) POINT
set gInfo(7) POINT
set gInfo(8) COLUMN
set gInfo(9) KEEP
set gInfo(10) NEW:ADD:END
set gInfo(11) 0.0
set gInfo(12) -1.0e30
set gInfo(13) -1.0e20
set gInfo(14) 1.0e20
set gInfo(15) NO
set gInfo(16) NO
# GET the center values of each X grid. This is put into array cX
TUgridInfo 32 gInfo cX
# CREATE the Grid. The array Grid will be the base unfilled array
set Y(0) 0.0
TUdataGrid $nP 1 X X $nP Y Y V Grid Norm gInfo
# CREATE the grid gHF and fill the gaps using the HF method
TUdataGrid $nP 1 X X $nP Y Y V gHF Norm gInfo
TUgridFill1D gHF gInfo X HF -1 1 Norm
# CREATE the grid gHB and fill the gaps using the HB method
TUdataGrid $nP 1 X X $nP Y Y V gHB Norm gInfo
TUgridFill1D gHB gInfo X HB -1 1 Norm
# CREATE the grid gHM and fill the gaps using the HM method
TUdataGrid $nP 1 X X $nP Y Y V gHM Norm gInfo
TUgridFill1D gHM gInfo X HM -1 1 Norm
# CREATE the grid gLI and fill the gaps using the LI method
TUdataGrid $nP 1 X X $nP Y Y V gLI Norm gInfo
TUgridFill1D gLI gInfo X LI -1 1 Norm
# SHOW results graphically
GraphicsOn TK ETones SWAP
GenWindow 1 0.15 0.15 0.0 0.85 0.85 0.0 -3. -5.0 0. 4.0 15.0 0.
DefinePlot 1 1
# PLOT the unfilled in grid in blaok
set GoP [list $GphInfo(White) NONE]
Plot2D 1 Xb Yb cX Grid 0 499 LINE $GoP
# PLOT the HF filled in grid in red
set GoP [list $GphInfo(Red) NONE]
Plot2D 1 Xb Yb cX gHF 0 499 LINE $GoP
# PLOT the HB filled in grid in green
set GoP [list $GphInfo(Green) NONE]
Plot2D 1 Xb Yb cX gHB 0 499 LINE $GoP
# PLOT the center filled in grid in cyan
set GoP [list $GphInfo(Cyan) NONE]
Plot2D 1 Xb Yb cX gHM 0 499 LINE $GoP
# PLOT the linear filled in grid in blue
set GoP [list $GphInfo(Blue) NONE]
Plot2D 1 Xb Yb cX gLI 0 499 LINE $GoP
# PUT up the plot axis and axis labels
PlotOutlines 1 [list "X" 1.0 "Y" 1.0] [list BOT BOT BOTH BOTH]
# THROW up some labels
TextProp 12 HOLD HOLD
WinClip 1 0
TexT 1 -1.0 15.5 0.0 center "NO FILL" $GphInfo(White)
TexT 1 -1.0 16.5 0.0 center "HF" $GphInfo(Red)
TexT 1 2.0 15.5 0.0 center "HB" $GphInfo(Green)
TexT 1 2.0 16.5 0.0 center "HM" $GphInfo(Cyan)
TexT 1 2.0 17.5 0.0 center "LI" $GphInfo(Blue)
update
| Sept 21, 2006 |
|---|