[vtk-developers] About the vtkDataArray::InsertTuple() method

David Lonie david.lonie at kitware.com
Thu Mar 24 11:20:25 EDT 2016


On Thu, Mar 24, 2016 at 12:09 AM, David Gobbi <david.gobbi at gmail.com> wrote:

> Also related to data arrays: I'd love to see the deprecation of
> InsertValue() and InsertTuple().  The problems with them are:
>
> 1) They are redundant.  As far as I'm concerned, their usage can
> always be replaced with SetTuple() or InsertNextTuple() and the
> resulting code will become easier to read.
>
> 2) They don't actually "insert" tuples except at the end of the
> array, and we have InsertNextTuple() or that purpose.  Anywhere
> else in the array, they perform a replacement operation.
>
> Any thoughts?  Are these methods widely used anywhere except
> for VTK's own source tree?
>

I have to agree. Point (2) is the dealbreaker for me -- I know I've gotten
bitten by that, and I know others have been as well. The accepted meaning
of 'insert' simply does not match what these methods actually do.

Ideally, I'd rather keep them and make them function as expected -- insert
the tuple and push the tail of the array down by numComps. However, this
would likely lead to nasty, nasty bugs with legacy code.

TBH, there's a lot of the array API that I'd love to revamp -- get rid of
GetVoidPointer and WritePointer, update Insert*,
GetSize/GetMaxId/GetCapacity, etc. to match modern conventions, etc -- but
there's a lot of legacy code around these array classes at this point so
it's tough to fix the problems.

That said, if the community can get behind such changes, I feel that they
would be worth the pain. I'll go a step further and say that I'm willing to
implement the changes (in VTK/ParaView) if there's enough support/funding
around.

My $0.02,
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20160324/3364bcfa/attachment.html>


More information about the vtk-developers mailing list