[vtk-developers] asymmetry of SetNumberOfComponents and SetNumberOfTuples

Goodwin Lawlor goodwin.lawlor at ucd.ie
Thu Apr 22 15:01:52 EDT 2004


True... But from the documentation it seems that it's the Set... methods
that don't intentionally check in order to be fast. If you want range
checking, you can use the Insert... Methods. But there are no safe
Get... methods.

Goodwin
University College Dublin

-----Original Message-----
From: vtk-developers-admin at vtk.org [mailto:vtk-developers-admin at vtk.org]
On Behalf Of Lisa Avila
Sent: 22 April 2004 18:27
To: goodwin.lawlor at ucd.ie; 'VTK Developers'
Subject: RE: [vtk-developers] asymmetry of SetNumberOfComponents and
SetNumberOfTuples



Some methods intentionally don't check in order to be fast.


At 01:21 PM 4/22/2004, Goodwin Lawlor wrote:
>While we're on this subject of array allocation... Either
>
>vtkPoints p
>   p GetPoint 0
>
>Or
>
>vtkFloatArray fa
>   fa GetTuple1 0
>
>Etc.
>
>Both crash if they aren't allocated. There's no check to see if the id 
>exists. Should there be? Or should an application check explicitly?
>
>Goodwin
>University College Dublin
>
>-----Original Message-----
>From: vtk-developers-admin at vtk.org 
>[mailto:vtk-developers-admin at vtk.org]
>On Behalf Of Michael Halle
>Sent: 22 April 2004 17:46
>To: 'VTK Developers'
>Subject: [vtk-developers] asymmetry of SetNumberOfComponents and
>SetNumberOfTuples
>
>
>Today I got burned by the fact that if you have
>a data array and you call
>
>SetNumberOfComponents, then
>SetNumberOfTuples
>
>everything is fine, but
>
>SetNumberOfTuples, then
>SetNumberOfComponents
>
>will cause a core dump for ntuples > 1.
>
>Turns out that SetNumberOfTuples does the allocation,
>while NumberOfComponents is just an ivar.
>
>This seems like it would be a pretty common "gotcha": shouldn't both 
>allocate or reallocate as needed?
>
>(Yes, this behavior is sort of documented, but that's not
>the point.)
>
>Michael Halle
>mhalle at bwh.harvard.edu
>
>_______________________________________________
>vtk-developers mailing list
>vtk-developers at vtk.org 
>http://www.vtk.org/mailman/listinfo/vtk-developers
>
>_______________________________________________
>vtk-developers mailing list
>vtk-developers at vtk.org 
>http://www.vtk.org/mailman/listinfo/vtk-developers


_______________________________________________
vtk-developers mailing list
vtk-developers at vtk.org
http://www.vtk.org/mailman/listinfo/vtk-developers




More information about the vtk-developers mailing list