Skip to content

Improve specializations of Hybrid::size()

Carsten Gräser requested to merge cleanup/improve-hybrid-size into master

The interfaces tested subsequently for Hybrid::size(const T& t) are now

  • standard tuple-like interface std::tuple_size<T>::value (e.g. needed for std::tuple),
  • static constexpr T::size() (e.g. needed for Dune::TupleVector),
  • static constexpr T::N() (e.g. needed for Dune::MultiTypeBlockMatrix),
  • dynamic member function t.N() (e.g. needed for Dune::Matrix),
  • dynamic member function t.size() (e.g. needed for std::vector).

Unfortunately the matrix interface is rather inconsistent. While Dune::DenseMatrix provides a dyanmic size() method, the dynamic dense matrix Dune::Matrix does not. The only consistent interface to get the number of rows is the N() method which exists in dynamic (e.g. Dune::Matrix) and constexpr static (e.g. Dune::MultiTypeBlockMatrix) flavour. Hence to support matrices consistently, we must add support for those cases, too.

For the static constexpr N(), this was made neccessary, because of the removal of static consexpr Dune::MultiTypeBlockMatrix::size(). The dynamic case should be added for consistency to also support Dune::Matrix and Dune::BCRSMatrix. As a by-product, this allows to get rid of the FieldMatrix specialization.

Support for the N() cases was removed from the MR and left to future discussion. This MR now removes an obsolete special case for FieldVector, extends the test to cover this case, and fixes the documentation.

Edited by Carsten Gräser

Merge request reports

Loading