[vtk-developers] help with vtkDataSetAttributes and vtkDataArray
Berk Geveci
berk.geveci at gmail.com
Wed Jun 1 10:39:30 EDT 2005
Hi Andrew,
> Question 1:
> My first question concerns the the interface of vtkDataArray. It has
> two methods that are not virtual:
>
> void GetTuples(vtkIdList *ptIds, vtkDataArray *output);
> void GetTuples(vtkIdType p1, vtkIdType p2, vtkDataArray *output);
>
> Because they are not virtual, I cannot override them in my subclass so
> that they do the right thing. Does anyone know why they are not
> virtual? Is there any chance that they might become virtual in future
> releases?
No good reason. I can make these virtual.
> Question 2:
> To test my strategy, I am using a visualization algorithm which calls the method
> ...
> I realize that the existence of the GetVoidPointer() method may doom
> my project. In order for this method to "do the right thing", every
> subclass of vtkDataArray must have the same memory layout and storage
> for the data. Because my subclass is an Adapter, the correct thing to
> do with GetVoidPointer() is return NULL.
This is a problem. There is code in VTK (relatively common) that
accesses data pointers directly. This is mainly for performance
reasons. Calling a virtual function to access a tuple is way more time
consuming that directly dereferencing the pointer. Because of this,
we will not change this behaviour. However, there may still be hope
for you :-) In the development version of VTK, there is a framework
that allows adaptors to external datasets. I was only superficially
involved in the effort so I can't provide much information. If you
post a question, I am sure Francois or Will will answer. Be sure to
mention generic datasets.
-Berk
More information about the vtk-developers
mailing list