<div dir="ltr">Hi Sean,<div><br></div><div>You'd have to do the copy yourself in this case. Also, in this case I think it's valid to use the GetVoidPointer() after you've set the number of tuples and components and do a memcpy yourself as you know that it will be in the "legacy" VTK ordering style because you're manually creating it. With the alternate memory layouts of vtkDataArray derived classes it's very bad practice to use the GetVoidPointer() method for arrays of unknown origin since if it is in the SOA layout it will have to do a deep copy to get it into the AOS layout.</div><div><br></div><div>Cheers,</div><div>Andy</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 14, 2017 at 10:34 AM, Sean McBride <span dir="ltr"><<a href="mailto:sean@rogue-research.com" target="_blank">sean@rogue-research.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Following-up on an older thread...<br>
<br>
First, thanks!<br>
<br>
Now I'm interested in the opposite.  That is, I have an existing raw buffer of say doubles that comes from somewhere else.  I want to create a vtkDoubleArray that *copies* the data.  Is there any API that takes a raw buffer and does a memcpy?  Otherwise is it best to call InsertNextTuple() in a loop?<br>
<br>
Cheers,<br>
<br>
Sean<br>
<br>
<br>
On Fri, 9 Jun 2017 09:42:12 -0400, David Lonie said:<br>
<br>
>If you just want to dump the data from any vtkDataArray into a memory<br>
>buffer using AOS ordering (e.g. typical VTK memory layout with<br>
>coherent tuples), something like:<br>
><br>
>vtkDataArray *array = ...;<br>
>int bufSize = array->GetNumberOfValues() * array->GetDataTypeSize();<br>
>void *buffer = malloc(bufSize);<br>
>array->ExportToVoidPointer(<wbr>buffer);<br>
><br>
>will be the most efficient way to do this.<br>
><br>
>HTH,<br>
>Dave<br>
><br>
>On Thu, Jun 8, 2017 at 12:14 PM, Sean McBride <<a href="mailto:sean@rogue-research.com">sean@rogue-research.com</a>> wrote:<br>
>> Hi all,<br>
>><br>
>> Since the vtkDataArray changes in VTK 7.1, what is the current best/<br>
>fastest way to extract the points, strips, and normals from a<br>
>vtkPolyData into another memory buffer?<br>
>><br>
>> I'm always working with the same kind of data, so I'm hoping to<br>
>preflight the sizes/types and then basically memcpy() the data out.<br>
<br>
<br>
______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>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" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/vtkusers</a><br>
</blockquote></div><br></div>