[vtkusers] How to attach vtkIdlist to vtkDataSet?

Andy Bauer andy.bauer at kitware.com
Fri Sep 13 17:39:51 EDT 2013


Hi,

First, you probably want to use vtkIdTypeArray to get type consistency.
After that, you'll want to use SafeDowncast to convert the array returned
from vtPointData to vtkIdTypeArray. Then you can use GetValue() or
GetTupleValue() to avoid the type conversion.

Andy


On Fri, Sep 13, 2013 at 12:50 PM, Sunrise <helios.corona at gmail.com> wrote:

> Hello, I have two datasets, an vtkUnstructuredGrid and a vtkPolyData. The
> polydata is physically inside unstructured grid. For each point of
> polydata, I have an Id of the Cell of unstructuredgrid which that point is
> located inside that cell. I stored the Ids in vtkIdList. Now, I want to
> attach the vtkIdList to the polydata (like
> vtkPolyData::GetPointData()->SetScalars(myIds)). But it seems only
> vtkDataArrays can be an argument (like vtkIntArray). I could use
> vtkIntArray at first. The little problem with vtkIntArray is that its
> output is double type again (double vtkIntArray::GetTuple()), so I have to
> cast its output to unsigned int every time I want to get an Id. While my
> guess is that vtkIdList is designed for integers and does not have such
> problems. Is there any way to assign vtkIdlist to vtkDataSet? Thanks.
> ------------------------------
> View this message in context: How to attach vtkIdlist to vtkDataSet?<http://vtk.1045678.n5.nabble.com/How-to-attach-vtkIdlist-to-vtkDataSet-tp5723467.html>
> Sent from the VTK - Users mailing list archive<http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html>at Nabble.com.
>
> _______________________________________________
> 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
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130913/c2a4c27c/attachment.htm>


More information about the vtkusers mailing list