[vtk-developers] vtkDataArrayTemplate

John Biddiscombe biddisco at cscs.ch
Mon Nov 24 09:33:27 EST 2008


Benjamin

The GetTuple interface is only intended if you really don't know what 
type of data you are expecting. You should use the GetPointer cast to 
float/double etc - this gives you raw access to the array in native 
form. Only use the GetTuple in emergencies.

vtkDataArrayTemplate is already remplated over types for the bulk of 
work in creating the class definitions for each type. You should look at 
some of the imageing filters for examples of how to get a scalar pointer 
then execute on whatever type you need.

I'm keeping this reply brief as timeis too short. Hopefully someone else 
will give you further details if you need them.

JB
> Hi
>
> I noticed that my code ran very slow so I did some profiling and I 
> noticed to my horror, that about 50% of all time is spent inside the 
> GetTuple (and it's wrappers). Looking at the code I noticed that for 
> every access a copy of a tuple is generated which is pretty insane 
> when all you want is a distance to another point...
> I do realize that in vtk, you never know whether you work with floats 
> or doubles or ints etc, but I'm sure there are other ways that are not 
> this hard on performance
>
> Are there plans on improving this? I've looked at a few ideas and my 
> interest was caught by Eigen2, a very fast Math Library making 
> extensive use of templates challenging even the mkl in terms of speed. 
> They make heavy use of template expressions so there are no 
> intermediate copies at any point. I'd guess something like this would 
> be very much doable for vtk
>
> Even though it would be quite some work, I imagine all of vtk would 
> gain significantly from this - in terms of genericity, design and 
> performance
>
> Any comments?
>
> Cheers
> Benjamin
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at vtk.org
> http://www.vtk.org/mailman/listinfo/vtk-developers


-- 
John Biddiscombe,                            email:biddisco @ cscs.ch
http://www.cscs.ch/
CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82





More information about the vtk-developers mailing list