TABLE_BORDER
Add zero boundary values to a table


TABLE_BORDER is a C++ program which adds a layer of zero boundary values to a table.

To understand what's going on, assume that we begin with a set of (scalar) values on an M by N grid; we illustrate with M = 3 and N = 5:

        11  12  13  14  15
        21  22  23  24  25
        31  32  33  34  35
      

Suppose that this data represents the values of some quantity on the interior points of a 5 x 7 grid, and that we'd like to make a new version of the table which includes entries for these boundary values; that is, we want the M+2 by N+2 array created by adding one row and column to the beginning and end of the original table, and setting those values to 0. For our example, this would be:

         0   0   0   0   0   0   0
         0  11  12  13  14  15   0
         0  21  22  23  24  25   0
         0  31  32  33  34  35   0
         0   0   0   0   0   0   0
      

The TABLE_BORDER program is designed to do this, using the command line.

Now we are probably going to be dealing with much larger sets of data, stored in a file. So we have to figure out the rules for doing that:

Input file format: The initial data, which is "really" an M by N array, is to be thought of as a vector of length M * N, created by listing the first column, the second column, and so on to the last column. This data is stored in a file using the TABLE format. Our example data would be:

        # Comments are OK in a file if preceded by the comment character!
        #
        11
        21
        31
        12
        22
        ...
        34
        15
        25
        35
      
We will presume this file is called "u.txt".

(Pie in the Sky): In a future version of this program, the data at each node will be allowed to be vector-valued. That's one reason we are forcing the data currently to be listed with just a single value per line in the file!

Usage:

table_border u.txt v.txt 3 5
reads the data from u.txt, presumed to contain 3 rows by 5 columns, and adds a border to it, and writes the revised data out to v.txt.
table_border
in which case the program will interactively request the missing data.

Licensing:

The computer code and data files made available on this web page are distributed under the GNU LGPL license.

Languages:

TABLE_BORDER is available in a C++ version and a FORTRAN90 version.

Related Data and Programs:

TABLE, a file format which is used for the input and output of TABLE_BORDER

TABLE_DELAUNAY, a C++ program which reads a file of 2d point coordinates and computes the Delaunay triangulation.

TABLE_IO, a C++ library which can read or write a TABLE file.

TABLE_LATINIZE, a C++ program which can read a TABLE file and write out a "latinized" version.

TABLE_QUALITY, a C++ program which can read a TABLE file and print out measures of the quality of dispersion of the points.

TABLE_UNBORDER, a C++ program which can be used to remove the border from a table file.

TABLE_VORONOI, a C++ program which can read a TABLE file describing a set of 2D points, and print out information describing the Voronoi diagram of those points.

Source Code:

Examples and Tests:

Our test data is the results of the command

table_border u_01.txt v_01.txt 3 5
Note that the program will automatically repeat the command on a numerical sequence of input files! Test files you may copy include:

List of Routines:

You can go up one level to the C++ source codes.


Last revised on 12 November 2006.