Skip to content

Incorrect CartesianIndex when using ElementAccessor

If I use the ElementAccessor to create an element and access its index, the return CartesianIndex is wrong. For instance, if I run the following:

dom = Interval(0.0, 1.0) ⨱ Interval(0.0, 1.0);
nel = (4,4)
partition = CartesianProduct((d,n) -> IncreasingRange(d,n+1), dom, nel);
order = 2
trialspace = TensorProduct(
        SplineSpace(order, partition.data[1]),
        SplineSpace(order, partition.data[2])
    );
quadrule = TensorProduct((d, u) -> PatchRule(d; npoints=ceil(Int, Degree(u)+1), method=Legendre), partition, trialspace);
acc = ElementAccessor(testspace=trialspace, trialspace=trialspace, quadrule=quadrule, incorporate_weights_in_testfuns=true);
println(Element(acc,4).index)
println(Element(acc,5).index)
println(Element(acc,6).index)

then I expect the returned indices to be (4,1), (1,2) and (2,2). Instead, they are (4,1), (5,1), (1,2).