# 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.

### 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.

### 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:
• u_01.txt, input file #1, a 3 by 5 set of data.
• u_02.txt, input file #2, a 3 by 5 set of data.
• u_03.txt, input file #3, a 3 by 5 set of data.
• v_01.txt, output file #1, a 5 by 7 set of data.
• v_02.txt, output file #2, a 5 by 7 set of data.
• v_03.txt, output file #3, a 5 by 7 set of data.

### List of Routines:

• MAIN is the main program for TABLE_BORDER.
• CH_CAP capitalizes a single character.
• CH_EQI is true if two characters are equal, disregarding case.
• CH_IS_DIGIT returns TRUE if a character is a decimal digit.
• CH_TO_DIGIT returns the integer value of a base 10 digit.
• DTABLE_DATA_WRITE writes data to a real TABLE file.
• DTABLE_PRINT prints a double precision matrix, with an optional title.
• DTABLE_PRINT_SOME prints some of a double precision matrix.
• DTABLE_WRITE writes information to a real TABLE file.
• FILE_COLUMN_COUNT counts the number of columns in the first line of a file.
• FILE_EXIST reports whether a file exists.
• FILE_NAME_INC generates the next file name in a series.
• FILE_ROW_COUNT counts the number of row records in a file.
• I4_HUGE returns a "huge" integer value, usually the largest legal signed int.
• I4_INPUT prints a prompt string and reads an integer from the user.
• I4_MAX returns the maximum of two integers.
• I4_MIN returns the smaller of two integers.
• R8_EPSILON returns the R8 round off unit.
• S_LEN_TRIM returns the length of a string to the last nonblank.
• S_TO_I4 reads an I4 from a string.
• S_TO_R8 reads an R8 from a string.
• S_TO_R8VEC reads an R8VEC from a string.
• S_WORD_COUNT counts the number of "words" in a string.
• TIMESTAMP prints the current YMDHMS date as a time stamp.
• TIMESTRING returns the current YMDHMS date as a string.

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

Last revised on 12 November 2006.