← Back to team overview

dolfin team mailing list archive

Integer type transition

 

The first stage of the transition to a new integer type is complete.
Most of DOLFIN now uses std::size_t, and a new typedef 'DolfinIndex'
has been introduced for compatibility with linear algebra backends.
Please feel free to suggest a better name for this typedef. Presently,
DolfinIndex is just a typedef for int. This typedef should rarely be
visible to a user, and it should have a name that discourages its
unnecessary use.

There are some small changes on the Python size, most notably the need
to use "sizet" in place of "uint" for MeshFunctions. One can create
both uint (unsigned int)  and sizet (std::size_t) MeshFunctions, but
most interfaces expect sizet. We could eliminate the "uint" versions
and map "uint" to the sizet case. Opinions?

Some thought is required to figure out the mapping to numpy integer
types. std::size_t is easy because numpy has a type 'uintp' which is
the same as std::size_t. Dealing with DolfinIndex is harder because
figuring out its type from the SWIG side doesn't seem easy. One
solution is to use more data copying for in typemaps.

Garth


Follow ups