I am trying to generate a mapping of triangles to determine how they are connected to one another. To do this, I need to store the indices of any triangle into an array (array is clearer to me than a list). The problem is that the array of triangles has two dimensions; the first is the cell number, the second is the pointer to the index, of which there are three. So, a typical declaration for one cell would be:
array set tris {
1,1 23
1,2 25
1,3 34
}
Performing a puts $tris(1,1) results in 23 being printed. However, I want to abstract the cell number using a looping construct like foreach such as:
foreach cell {1 2 3 4 5} {
set indices [$dom getCell $cell]
array set tris {
$cell,1 [lindex indices 0]
$cell,2 [lindex indices 1]
$cell,3 [lindex indices 2]
}
}
In this loop, the [$dom getCell $cell] is a Pointwise command that returns a list of indices that define a triangle, and in this case the $cellth triangle. When I do this, and check the contents of $cells(2,1), I get an error stating, can't read "cells(2,1)": no such element in array. According to the returned value of [$dom getCell $cell], I get 23 25 34 for the first cell to check; so that is correct. But checking the array contents suggests I am not doing something correctly. What am I missing or doing incorrectly?