[vtkusers] VTK 7.1 vtkDataArray changes, current best way to copy vtkPolyData data?
Andy Bauer
andy.bauer at kitware.com
Thu Sep 14 10:38:54 EDT 2017
Hi Sean,
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.
Cheers,
Andy
On Thu, Sep 14, 2017 at 10:34 AM, Sean McBride <sean at rogue-research.com>
wrote:
> 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.
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170914/3e51c049/attachment.html>
More information about the vtkusers
mailing list