[vtk-developers] asymmetry of SetNumberOfComponents and SetNumberOfTuples
Goodwin Lawlor
goodwin.lawlor at ucd.ie
Thu Apr 22 13:21:09 EDT 2004
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
More information about the vtk-developers
mailing list