Draft: Remove FieldMatrix/Vector scalar specialization
(This is an experiment whether it would be possible to remove the FieldVector<K,1>
and FieldMatrix<K,1,1>
specialization completely.)
See accompanying MRs in other modules:
Merge request reports
Activity
mentioned in merge request dune-istl!601
mentioned in merge request dune-geometry!261
mentioned in merge request dune-localfunctions!284
mentioned in merge request dune-grid!767
mentioned in merge request staging/dune-functions!502
I agree that this should be removed, but expect that this break lots of user code. While most downstream libraries are (mostly) generic wrt the dimension anyway and thus require little effort to fix, there will be many users that use
Field*<*,1>
like a scalar, because this was for a long time encouraged by dune and partly still is (cf. e.g. dune-istl!600 (merged)).Sure, this is nothing quickly changed. I just wanted to try whether it is possible to do and what the consequences are before I formulate a proposal.
I have also seen that this interpretation as scalar is used in many places. Also the scalar local basis functions are using
FieldVector<T,1>
(this is another aspect but a little bit independent of this implicit conversion topic) and the evaluated shape functions are used like scalars everywhere. The core modules are mostly fine. dune-localfunctions needed the most changes. But, discretization modules are another topic. This will be more difficult to adapt.
Also the scalar local basis functions are using
FieldVector<T,1>
(this is another aspect but a little bit independent of this implicit conversion topic) and the evaluated shape functions are used like scalars everywhere.This also directly came to my mind. Currently the interface hard-codes a local basis range is always a vector with a certain dimension. This does not only lead to the problem you mentioned (identify scalar with
FieldVector<*,1>
) but is also to restrictive e.g. for matrix-valued bases like Arnold-Winther. While this seems to be orthogonal to the removal of the specialization, we should carefully consider the least painful transition path.If we e.g. want to generalize the local basis ranges and transition from
FieldVector<T,1>
to plainT
for simple scalar bases, it might be easier as long as there's some compatibility between the two types, as provided by the specialization.The issue with the scalar basis implemented with
FieldVector<T,1>
asRangeType
is actually theJacobianType
, which is aFieldMatrix<T,1,dim>
. There is no.dot()
product for single-row matrices directly. Thus, either people useJ[0].dot()
orJ * transposed(J)
. Both will not work if changed to aFieldVector
. I just wanted to separate this discussion from the scalar conversion, but also have the impression we should discuss this at some point and maybe revise our current design pattern.