MeshFunctionSizet uses a signed int type in the python interface

Issue #46 resolved
Martin Sandve Alnæs created an issue

Using a not-quite-latest dolfin, I wrote some testing code similar to this:

bnd = mesh.domains().facet_domains()
ba = bnd.array()
for i in xrange(len(ba)):
    print bnd[i], ba[i]

and this prints:

...
-1 18446744073709551615
...

the latter being the max unsigned value used by MeshFunction to represent unset values. Somewhere in the python wrapping this gets interpreted as a signed int.

Comments (2)

  1. Johan Hake

    I have looked at this and it seems like we would need a typemap which can return a long for these large numbers. But we only want a long for the largest numbers, right? I am a bit reluctant of returning a long though, as it is not an int. So:

    isinstance(0L, int) == False
    

    which probably breaks some interface.

    Then we would need a typemaps which convert a long to any of our most used integer types.

    I have something implemented that returns a long for the largest numbers and converts long to any of our integer types, it just needs some testing.

  2. Log in to comment