On 27 May 2013 23:13, Anders Logg <[email protected]> wrote:
> On Mon, May 27, 2013 at 11:07:38PM +0100, Garth N. Wells wrote:
>> On 27 May 2013 23:05, Anders Logg <[email protected]> wrote:
>> > On Mon, May 27, 2013 at 11:00:16PM +0100, Garth N. Wells wrote:
>> >> On 27 May 2013 22:47, Anders Logg <[email protected]> wrote:
>> >> > I've just pushed a new typedef 'mesh_index' for unsigned int, similar
>> >> > to the existing 'la_index'. I suggest we use it in place of unsigned
>> >> > int wherever we now use unsigned int in place of std::size_t to save
>> >> > space for local entity indices.
>> >> >
>> >>
>> >> Could you motivate the addition? la_index has a clear motivation -
>> >> compatibility with linear algebra backends.
>> >
>> > So that whenever we use 'unsigned int', it is for a clear purpose -
>> > either to save space or for compatibility with the index type used by
>> > the mesh library. It is otherwise likely that it is just using
>> > unsigned int out of old habit (as I'm prone to). It also has the
>> > advantage that we can easily change the definition of the type in the
>> > future if we should need it.
>> >
>>
>> For me a typedef has the opposite effect. It obscures the type. I find
>> it easy to choose between std::size_t and unsigned int because the
>> type is obvious. I would prefer to not introduce an unnecessary type.
>
> I find that 'mesh_index' conveys a purpose. Now we use size_t as our
> default unsigned integer type, except when for some reason we really
> want something else.

I find the opposite more natural. I would rather see and choose the
type rather than have it obscured by a tyepdef.

Under what circumstances is the type for mesh_index likely to change?

> There are currently two such examples: for
> compatibility with the linear algebra backends or for compatibility
> with the mesh library. It feels natural (to me) to then have la_index
> and mesh_index.

I don't like either, but la_index is out of necessity.

Garth

> When we then see 'mesh_index' in the code, it signals
> that whoever wrote that code had a purpose and was not writing
> unsigned int out of old habit.
>
> It's a small change to revert (only introduced so far in the geometry
> library). I won't insist on it but I'd like to hear some more comments
> first.
>
> --
> Anders
_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics

Reply via email to