Error in barycentric refinement of order 1 P space

Dear Bempp team,

I think there is an implementation error in the barycentric refinement of the order 1 P space in Bempp-cl 0.3.1. Calling bempp.api.space.scalar_spaces.p1_barycentric_continuous_function_space(coarse_space) returns a SpaceBuilder object, where the (numba) surface gradient is set to _numba_p0_surface_gradient (i.e., the surface gradient is the zero vector everywhere) and the order is set to 0. Since the function’s description also mentions “a space of piecewise constant functions”, I suppose that the definition of the barycentric order 0 P space and order 1 P space have been mixed up. First, I tried to fix this problem locally, however, there still seems to be an issue using the surface_gradient function of the order 1 P space’s barycentric refinement (test scripts build upon this function do not give the correct results). Could there be more errors than those mentioned above (in the bempp.api.space.scalar_spaces.p1_barycentric_continuous_function_space function)?

Thank you very much in advance.

Kind regards,
Raphael

Remark on the effect (to my knowledge): This error prevents the use of vector spaces (such as RWG or BC spaces) and order 1 P spaces together, as the former is defined on a barycentric grid and the latter, thus, requires barycentric refinement. If I am not mistaken, this means that operators such as the surface divergence or the surface gradient cannot be implemented correctly in Bempp-cl 0.3.1.
Is there any way to circumvent this issue?

Thank you in advance.

Kind regards,
Raphael

Actually, only BC (and, thus, RBC) spaces are directly defined on a barycentrically refined grid. Thus, my remark only fully applies for settings, where BC (or RBC) spaces are used. However, by using the multitrace operator bempp.api.operators.boundary.maxwell.multitrace_operator(grid, k, ...) we move into such a setting, if I am not mistaken.

Kind regards,
Raphael