On Mon, 17 Mar, 2014 at 10:56 AM, Johan Hake <[email protected]> wrote:
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.
What should the above do?
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?
I agree with your suggestion. I think info(parameters, 1) is bad
practice, so it's fine if it now fails. Related, I recently fixed C++
compile failures with clang where DOLFIN was lazy and used implicit
interger/bool casting. We should be more careful.
Garth
Johan
_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics