[vtk-developers] vtkAOSDataArrayTemplate annoying API change

David Lonie david.lonie at kitware.com
Thu Mar 24 12:00:28 EDT 2016


>
> On Wed, Mar 23, 2016 at 8:55 PM, Bill Lorensen <bill.lorensen at gmail.com>
> wrote:
>
>> Recently the API for vtkAOSDataArrayTemplate was changed.
>>
>> Set/Get/Insert/InsertNextTupleValue was changed to
>> Set/Get/Insert/InsertNextTypedTuple.
>>
>> What was the purpose of the name change?
>>
>
I believe it was Berk who first proposed this when I was making the data
array changes, so I'll let him correct me if I'm wrong. But as I understand
it this was simply to clarify the difference between the typed and untyped
getters/setters.

Personally, I'm ambivalent about the change. It's a definite improvement to
the API, but any and all API changes are annoying for backwards
compatibility, so it's a win/lose situation.

On Wed, Mar 23, 2016 at 11:51 PM, David Gobbi <david.gobbi at gmail.com> wrote:

> Actually, I recommend going even further: add new methods
> called GetTypedValue() et al. and deprecate GetValue() et al.
> Then, for VTK 8, I would love to see these method appear:
>
>   double vtkDataArray::GetValue()
>

GetValue is not defined at the vtkDataArray level, and nor should it be
(IMO).

My reasoning: vtkDataArray no longer assumes AOS ordering. The decision was
that, ideally, vtkDataArray API would operate on tuples and components,
while subclasses (e.g. AOS or SOA) would provide these more
implementation-dependent lookups. In the context of SOA ordering, the value
indices don't make a whole lot of sense and are inefficient to use, while
GetComponentValue is efficient in either case.


>   vtkIdType vtkAbstractArray::GetNumberOfValues()
>
I would really like GetNumberOfValues() to make a comeback.
>

I agree -- so much so that I already added it! ;) It's not gone, it's just
moved out of the implementation class to vtkAbstractArray.

On Thu, Mar 24, 2016 at 12:48 AM, Bill Lorensen <bill.lorensen at gmail.com>
 wrote:

> The new names don't make much sense to me.
>
Can you elaborate? Compare:

GetTuple vs. GetTupleValue
to
GetTuple vs. GetTypedTuple

The meaning of the typed method seems much clearer now IMO. Do you feel the
old method names more clearly communicate the reason for the method's
existence to someone new to VTK?

Cheers,
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20160324/a253f82d/attachment.html>


More information about the vtk-developers mailing list