SWIG 3.0 was just released with some backward incompatible changes to the
bool typemap.

Previously the typemap just checked if a Python object could be evaluated
as a bool. Several different classes implement such conversion also dolfin
making:

  info(mesh, FunctionSpace(mesh, "CG", 1))

perfectly valid. Now one can only pass var for which:

  isinstance(var, bool)

return True.

As a general comment I think this is good, but it also make other more
handy user cases fails, like numpy.bool_ and python int. The former is used
in the inside method of SubDomain (x[0]<0.5) and the latter in a typical
call to info(parameters, 1).

I suggest we extend the typemap for SWIG 3.0 to also include numpy.bool_
but I am reluctant to make info(parameters, 1) work. Users could easily
update there practice to write info(parameters, True)

Any comments?

Johan
_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics

Reply via email to