[vtkusers] VTK 7.1 vtkDataArray changes, current best way to copy vtkPolyData data?

Sean McBride sean at rogue-research.com
Thu Sep 14 10:34:01 EDT 2017


Following-up on an older thread...

First, thanks!

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?

Cheers,

Sean


On Fri, 9 Jun 2017 09:42:12 -0400, David Lonie said:

>If you just want to dump the data from any vtkDataArray into a memory
>buffer using AOS ordering (e.g. typical VTK memory layout with
>coherent tuples), something like:
>
>vtkDataArray *array = ...;
>int bufSize = array->GetNumberOfValues() * array->GetDataTypeSize();
>void *buffer = malloc(bufSize);
>array->ExportToVoidPointer(buffer);
>
>will be the most efficient way to do this.
>
>HTH,
>Dave
>
>On Thu, Jun 8, 2017 at 12:14 PM, Sean McBride <sean at rogue-research.com> wrote:
>> Hi all,
>>
>> Since the vtkDataArray changes in VTK 7.1, what is the current best/
>fastest way to extract the points, strips, and normals from a
>vtkPolyData into another memory buffer?
>>
>> I'm always working with the same kind of data, so I'm hoping to
>preflight the sizes/types and then basically memcpy() the data out.




More information about the vtkusers mailing list