<div dir="ltr"><div>> Don't even get me started on what vtkIdType *is* correct for</div><div>> semantically... "id" to me implies something that can identify an</div><div>> object across a wide swath of operations. Since it's almost always just</div>

<div>> an index into some array, a vtkIdType value does not really "id"</div><div>> anything, *except* in a given container filled once with data and no</div><div>> inserts or removes allowed. Fortunately for VTK, that's the main use</div>

<div>> case when visualizing a large data set.</div><div><br></div><div>I disagree. vtkIdType is supposed to be the type of the id that identifies</div><div>things like points and cells. The fact that the most common data</div>

<div>structures in VTK store these in contiguous arrays is irrelevant to</div><div>the validity of the term. VTK can easily support a vtkDataSet subclass</div><div>that stores a map of (ids -> cell objects) for connectivity. The API</div>

<div>abstracts away the underlying storage details (for the most part).</div><div><br></div><div>My main issue with the current vtkIdType usage is that it is also used</div><div>to define the size of the integer used in cell arrays to refer to points. So</div>

<div>even if you have less than 2^31 point, you end up using 64 bits in the cell array</div><div>to store the ids. Which doubles the storage. In my opinion, this should</div><div>be run-time configurable. Furthermore, we should use size_t when defining</div>

<div>offsets into these arrays, not vtkIdType. (See the Locations data member</div><div>of vtkUnstructuredGrid for example). </div><div><br></div><div>Best,</div><div>-berk</div><div><br></div><div class="gmail_extra"><br>

<br><div class="gmail_quote">On Mon, Jul 7, 2014 at 9:34 AM, David Cole via vtk-developers <span dir="ltr"><<a href="mailto:vtk-developers@vtk.org" target="_blank">vtk-developers@vtk.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

> "The other David"™<br>
<br>
:-)<br>
<div class=""><br>
<br>
> To answer more directly, I<br>
> brought this up because I made this change the other day:<br>
><br>
> <<a href="http://review.source.kitware.com/15924" target="_blank">http://review.source.kitware.com/15924</a>><br>
><br>
> and noticed the possibility of overflow.<br>
><br>
</div>> ...<br>
> ... just a size count, for which size_t seems the best type (as it's<br>
> what sizeof() returns).<br>
<br>
Right, but using size_t will still give you a potential overflow<br>
problem in a 32-bit pointer build... Shouldn't the type *always* be<br>
large enough to represent expected actual memory sizes encountered in<br>
the wild? And therefore, shouldn't it be something that's always at<br>
least 64-bits wide as "the other David" suggested...?<br>
<br>
Don't even get me started on what vtkIdType *is* correct for<br>
semantically... "id" to me implies something that can identify an<br>
object across a wide swath of operations. Since it's almost always just<br>
an index into some array, a vtkIdType value does not really "id"<br>
anything, *except* in a given container filled once with data and no<br>
inserts or removes allowed. Fortunately for VTK, that's the main use<br>
case when visualizing a large data set.<br>
<br>
<br>
David C.<br>
<div class=""><div class="h5"><br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtk-developers" target="_blank">http://public.kitware.com/mailman/listinfo/vtk-developers</a><br>
<br>
</div></div></blockquote></div><br></div></div>