[vtk-developers] vtkDataArray::GetTuple behavior

Brad King brad.king at kitware.com
Thu Jun 3 08:58:31 EDT 2004


David C. Thompson wrote:
> Hi,
> 
> 	I was looking at vtkDataArray.cxx and noticed this implementation of
> GetTuple(int,double*)
> 
> // default double behaviour
> void vtkDataArray::GetTuple(vtkIdType i, double * tuple)
> {
>   int c;
>   int numComp=this->GetNumberOfComponents();
>   double *ftuple=new double[numComp];
>   this->GetTuple(i,ftuple);
>   for (c = 0; c < numComp;  c++)
>     {
>     tuple[c] = ftuple[c];
>     }
>   delete [] ftuple;
> }
> 
> In vtkDataArray.h, it looks like GetTuple(int,double*) is supposed to be
> pure virtual. Upon further examination, it seems that the ftuple
> variable used to be float* and that this bit of flotsam and jetsam got
> created during the great float->double conversion of '03. Am I right,
> and if so, should this whole function be removed from vtkDataArray.cxx?

It is a good thing the header declares this pure virtual, or someone 
might be able to create an object that would use this implementation. 
Then they would get infinite recursion.  I see no problem with removing it.

-Brad



More information about the vtk-developers mailing list