Set real_type of MultiTypeBlockVector
Summary
The MultiTypeBlockVector
already defines its field_type
conditionally as common-type over all field-types of its components. If no such common-type exists, the field_type
is defined as Std::nonesuch
. In this case, the real_type
shouldn't simply be defines as using real_type = typename FieldTraits<field_type>::real_type
, since then the FieldTraits
be potentially illformed or by default the same as Std::nonesuch
. While there might not be a common field_type
it could still be defined a common real_type
.
This MR fixes this in MultiTypeBlockVector
and correspondingly in MultiTypeBlockMatrix
by defining field_type
and real_type
independently.
Merge request reports
Activity
mentioned in merge request dune-common!1040
- Resolved by Christian Engwer
added 177 commits
-
ccacfa01...20bcffa6 - 174 commits from branch
master
- 5fcbfc75 - Set real_type of MultiTypeBlockVector
- 09a47cbd - Set field_type and real_type correctly in MultiTypeBlockMatrix
- 9d3eb180 - Remove old definitions of field_type and real_type
Toggle commit list-
ccacfa01...20bcffa6 - 174 commits from branch
added 1 commit
- 5bf1a5c6 - Set field_type and real_type correctly in MultiTypeBlockMatrix
enabled an automatic merge when the pipeline for 9966375f succeeds
mentioned in commit f37f90ae
I don't understand, it should have been mandatory before, because the
FieldTraits<Args...>::field_type
was used before. This MR extends this toreal_type
and also in theMultiTypeBlockMatrix
that has used theMultiTypeBlockVector::field_type
before and thus also theFieldTraits
specialization.The annoying thing about this, is that you can no longer simply derive from a dune-istl matrix, because the derived matrix does not inherit the
FieldTraits
specialization.I strongly suggest to no longer promote the use of
FieldTraits
until we have fixed its behavior and added a precise definition. If this incorporates that we introduce a breaking change, this should be clearly documented in the changelog. Currently the entry is wrong in this respect, because it gives the impression that a common type for theM::field_type
types should exist. In contrast to this the implementation requires a common type of theFieldTraits<M>::field_type
types.I don't understand, it should have been mandatory before, because the
FieldTraits<Args...>::field_type
was used before. This MR extends this toreal_type
and also in theMultiTypeBlockMatrix
that has used theMultiTypeBlockVector::field_type
before and thus also theFieldTraits
specialization.It was used in some of the template methods which may or may not be instantiated in user code. Now it is a hard requirement that is enforced by a
static_assert
.This MR was merged to fix the issues showing up in dune-common!1040. Sorry, that I broke downstream code. I have tested many modules but no problem showed up.
Ah, now I see. But this is outside of the scope of the
MultiTypeBlockMatrix
. It states "This matrix class combines MultiTypeBlockVector elements as rows." At least this was my assumption.That's a good argument. However, one may argue that "B derives from A" implies that each instance of B is also an instance of A.
How to proceed? We could either revert the MR and go back to the old state. This is in conflict with the dune-common!1040. Or we find a compatible solution.
One solution I could think of: I don't use
FieldTraits
specializations of the rows in theMultiTypeBlockMatrix
but just the::field_type
member, since I would assume that the rows are ofMultiTypeBlockVector
those should exist. And I do acommon_type
over these direct aliases, instead of theFieldTraits
indirection.Maybe I could improve the
static_assert
. It was supposed to tell the user of the class to provide aFieldTraits
specialization of the block types.Edited by Simon Praetorius