TUgridPrint TCL UTILITIES USER MANUAL TUgridPrint
SYNOPSIS
Print a grid to an ASCII file
PACKAGE
TCLUTILS
NAME
TUgridPrint
USAGE
set rV  [TUgridPrint  File Gridp Grids gInfo Open {Close}]
INPUT DEFINITIONS
File - The file name to print the grid to or a file descriptor if the file is already open.
Gridp - The primary 2D data grid to be printed out.
Grids - A secondary grid which has the same grid description as Gridp which is to be included in the file. This is often the grid normalization array. If Grids is passed in as a dummy array (non-existant) array it is omitted from the print file.
gInfo - The grid information array for the input data grid(s).
Open - The method use to open or create the print file.
OpenW - Open the print file to write. This will create the print file if it doesn't exist and erase the current contents if it does.
OpenA - Open the print file in append mode. The file will be created if it doesn't exist but if it does exist it will append the output to the end of the the file.
Opened - File is current open and File contains the file descriptor. the file.
Close - If 1 close the file on existing otherwise leave it open.
RETURN DEFINITION
The file descriptor. This is -1 if the file has been closed by the procedure.
DESCRIPTION
TUgridPrint dumps the content of a data Gridp to an ASCII file. The dump can include a second data Grids in the dump if it is described by an indentical set of grid information as the primary grid. This is often the grid normalization array. The information dumped to the file includes the complete grid information array for the grid and then one line of information for each grid cell. This include in order, the cell center position (X followed by Y) and the value associated with the cell. If there is a Grids included in the call its value in included as the last element in the line.
The procedure can dump the information in several ways. It can create the output file or overwrite it if it exists; it can append to it if it exists, or it can make use of an already open file. On exiting the routine can either close the file or leave it open.
ERRORS
TUgridPrint ERROR ... CANNOT OPEN File
None Generated
C BACKING
No
EXAMPLE(S)
EXAMPLE 1:Dump a grid and its normalization array.
# GRID print example

# ESTABLISH a simple 2D data set.

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

# SET up the grid information array.  Only 9 cells in the grid 

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

# DUMP the grid to the file GridDmp

TUgridPrint GridDmp Vv Norm gInfo OpenW


File GridDmp contents:

> XSTART   : -1.0
> XEND     : 1.0
> YSTART   : -1.0
> YEND     : 1.0
> XLENGTH  : 3
> YLENGTH  : 3
> XSTORAGE : POINT
> YSTORAGE : POINT
> GSTORAGE : COLUMN
> ZEROS    : IGNORE
> DO       : NEW:ADD:END
> UNFILLED : -1
> BAD      : -5
> GMIN     : -1.0e30
> GMAX     : 1.0e30
> XCYCLIC  : NO
> YCYCLIC  : NO
> -6.666667e-01  -6.666667e-01  0.000000e+00  4.800000e+01
> -6.666667e-01  5.000445e-13  1.000000e+00  4.900000e+01
> -6.666667e-01  6.666667e-01  2.000000e+00  4.200000e+01
> 5.000445e-13  -6.666667e-01  3.000000e+00  4.900000e+01
> 5.000445e-13  5.000445e-13  4.000000e+00  4.900000e+01
> 5.000445e-13  6.666667e-01  5.000000e+00  4.200000e+01
> 6.666667e-01  -6.666667e-01  6.000000e+00  4.200000e+01
> 6.666667e-01  5.000445e-13  7.000000e+00  4.200000e+01
> 6.666667e-01  6.666667e-01  8.000000e+00  3.600000e+01

      
Sept 25, 2006