ufl
ufl copied to clipboard
ufl.constantvalue.as_ufl should use the numbers hierarchy
ufl.constantvalue.as_ufl
checks values against the intrinsic types float
, complex
, and int
. This breaks for other scalar types, for example entries in numpy arrays. The check should instead be for numbers.Real
, numbers.Complex
, and numbers.Integral
respectively.
https://github.com/FEniCS/ufl/blob/e1e8e5627b0c7db17687bdb32857820ac4ddc072/ufl/constantvalue.py#L488C1-L500C1
Obviously any PR will need tests.