<div dir="ltr"><div>The pointer is only valid until another method is called (see <a href="http://www.vtk.org/doc/nightly/html/classvtkDataArray.html#aca11c70280dad75aabbe5747c55c6919">http://www.vtk.org/doc/nightly/html/classvtkDataArray.html#aca11c70280dad75aabbe5747c55c6919</a>).  The class stores the double data internally and it is copied there and the pointer returned.  So, you will not be getting around copying data and would probably be best using <span style="font-size:13px;font-family:arial,sans-serif"> </span><font face="Courier New, Courier, monospace" style="font-size:13px">GetTuple(i,double*)</font>.  If you really need to stop any memory copying you could use vtkAbstractArray::GetVoidPointer.</div>
<div><br></div><div>Regards,<br>Paul</div><div><br></div><br><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 8 March 2014 17:00, Sunrise <span dir="ltr"><<a href="mailto:helios.corona@gmail.com" target="_blank">helios.corona@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  

    
  
  <div 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>
  </div>

<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>