<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
I have a <font face="Courier New, Courier, monospace">vtkDoubleArray</font>,
and I want to create a <font face="Courier New, Courier, monospace">double</font>
array of pointers that point to some subset of tuples of the <font
face="Courier New, Courier, monospace">vtkDoubleArray</font>. I do
not want to use <font face="Courier New, Courier, monospace">GetComponent(i,j)
</font>or <font face="Courier New, Courier, monospace">GetTuple(i,double)
</font>and allocate new memory for the subset of the original array,
rather, I would like to just point to the original array with an
array of pointers, and getting the pointers with <font
face="Courier New, Courier, monospace">GetTuple(Id)</font>.<br>
<br>
For example, let <font face="Courier New, Courier, monospace">vtkDoubleArray
*vtkArray</font> has 4 tuples and 3 components, and Initialized as<br>
<br>
<font face="Courier New, Courier, monospace"><font face="Helvetica,
Arial, sans-serif">Assume</font> vtkArray</font> has the
following 4 tuples:<br>
Tuple0: <font face="Courier New, Courier, monospace">{0,1,2}</font><br>
Tuple1: <font face="Courier New, Courier, monospace">{3,4,5}</font><br>
Tuple2: <font face="Courier New, Courier, monospace">{6,7,8}</font><br>
Tuple3: <font face="Courier New, Courier, monospace">{9,10,11}</font><br>
<br>
Now I create <font face="Courier New, Courier, monospace">double
*SubArray[2]</font>. Then I want to point to tuples 1 and 3 of the
<font face="Courier New, Courier, monospace">vtkArray</font>:<br>
<br>
<font face="Courier New, Courier, monospace">double *SubArray[2];<br>
SubArray[0] = vtkArray->GetTuple(0);</font><br>
<br>
Now<font face="Courier New, Courier, monospace"> SubArray[0] </font>should
be <font face="Courier New, Courier, monospace">{0,1,2}</font>.<br>
<br>
Adding pointer of tuple 3<br>
<font face="Courier New, Courier, monospace">SubArray[1] =
vtkArray->GetTuple(3);</font><br>
<br>
Here is the problem that I have: After setting pointer of Tuple3 to
the <font face="Courier New, Courier, monospace">SubArray[1]</font>,
the <font face="Courier New, Courier, monospace">SubArray[0]</font>
is changed to point to Tuple3 too. It means<br>
<br>
<font face="Courier New, Courier, monospace">SubArray[0] = {9,10,11}</font>
// points to Tuple 3 not Tuple 1<br>
<font face="Courier New, Courier, monospace">SubArray[1] = {9,10,11}</font><br>
<br>
How can I fix this?<br>
<br>
Thanks,<br>
Sia<br>
</body>
</html>