diff --git a/dune/matrix-vector/matrixtraits.hh b/dune/matrix-vector/matrixtraits.hh index 5b673ed6d66a37d523f6a8135b54a31fd2293e0f..73c3c0d9860dae48eadb7e72be4dd752756cc0bc 100644 --- a/dune/matrix-vector/matrixtraits.hh +++ b/dune/matrix-vector/matrixtraits.hh @@ -17,45 +17,45 @@ namespace Dune { template<class T> struct MatrixTraits { - enum { isMatrix=false }; - enum { rows=-1}; - enum { cols=-1}; + constexpr static bool isMatrix = false; + constexpr static int rows = -1; + constexpr static int cols = -1; }; template<class T, int n, int m> struct MatrixTraits<Dune::FieldMatrix<T,n,m> > { - enum { isMatrix=true }; - enum { rows=n}; - enum { cols=m}; + constexpr static bool isMatrix = true; + constexpr static int rows = n; + constexpr static int cols = m; }; template<class T, int n> struct MatrixTraits<Dune::DiagonalMatrix<T,n> > { - enum { isMatrix=true }; - enum { rows=n}; - enum { cols=n}; + constexpr static bool isMatrix = true; + constexpr static int rows = n; + constexpr static int cols = n; }; template<class T, int n> struct MatrixTraits<Dune::ScaledIdentityMatrix<T,n> > { - enum { isMatrix=true }; - enum { rows=n}; - enum { cols=n}; + constexpr static bool isMatrix = true; + constexpr static int rows = n; + constexpr static int cols = n; }; template<class T> struct MatrixTraits<Dune::BCRSMatrix<T> > { - enum { isMatrix=true }; + constexpr static bool isMatrix = true; }; template<class... T> struct MatrixTraits<MultiTypeBlockMatrix<T...> > { - enum { isMatrix=true }; + constexpr static bool isMatrix = true; }; } } diff --git a/dune/matrix-vector/scalartraits.hh b/dune/matrix-vector/scalartraits.hh index 0894730ad29590547ce0cb9883ad2338125c1c5a..66b47c3bf0f964893f9d7fd99f35fba7ede9eb9f 100644 --- a/dune/matrix-vector/scalartraits.hh +++ b/dune/matrix-vector/scalartraits.hh @@ -16,29 +16,27 @@ namespace MatrixVector { */ template <class T> struct ScalarTraits { - enum { - isScalar = Dune::IsNumber<T>::value - }; + constexpr static bool isScalar = Dune::IsNumber<T>::value; }; template <class T> struct ScalarTraits<Dune::FieldVector<T, 1>> { - enum { isScalar = true }; + constexpr static bool isScalar = true; }; template <class T> struct ScalarTraits<Dune::FieldMatrix<T, 1, 1>> { - enum { isScalar = true }; + constexpr static bool isScalar = true; }; template <class T> struct ScalarTraits<Dune::DiagonalMatrix<T, 1>> { - enum { isScalar = true }; + constexpr static bool isScalar = true; }; template <class T> struct ScalarTraits<Dune::ScaledIdentityMatrix<T, 1>> { - enum { isScalar = true }; + constexpr static bool isScalar = true; }; } } diff --git a/dune/matrix-vector/singlenonzerocolumnmatrix.hh b/dune/matrix-vector/singlenonzerocolumnmatrix.hh index 4225019a27c2ee06fbebd710d55e05a5c9d0dad2..6b515d456cec51a4ecab4a394aba88e8df3234ac 100644 --- a/dune/matrix-vector/singlenonzerocolumnmatrix.hh +++ b/dune/matrix-vector/singlenonzerocolumnmatrix.hh @@ -46,7 +46,8 @@ class SingleNonZeroColumnMatrix }; public: - enum { rows = ROWS, cols = COLS}; + constexpr static int rows = ROWS; + constexpr static int cols = COLS; typedef RowProxy row_type; typedef row_type const_row_reference; @@ -117,12 +118,12 @@ namespace Arithmetic template<class K, int ROWS, int COLS> struct MatrixTraits<SingleNonZeroColumnMatrix<K, ROWS, COLS> > { - enum { isMatrix = true }; - enum { isDense = false }; - enum { sizeIsStatic = true }; //TODO only one of these should be used - enum { hasStaticSize = true }; //TODO only one of these should be used - enum { rows = ROWS}; - enum { cols = COLS}; + constexpr static bool isMatrix = true; + constexpr static bool isDense = false; + constexpr static bool sizeIsStatic = true; // TODO only one of these should be used + constexpr static bool hasStaticSize = true; // TODO only one of these should be used + constexpr static int rows = ROWS; + constexpr static int cols = COLS; /* typedef typename SingleNonZeroColumnMatrix<K, ROWS, COLS>::ConstColIterator ConstColIterator; diff --git a/dune/matrix-vector/singlenonzerorowmatrix.hh b/dune/matrix-vector/singlenonzerorowmatrix.hh index 5de2968a495103c8bc4040c297220f1af0fb0b31..f88b769a5d4d29a0f43572e38b347d8be32b314d 100644 --- a/dune/matrix-vector/singlenonzerorowmatrix.hh +++ b/dune/matrix-vector/singlenonzerorowmatrix.hh @@ -54,7 +54,8 @@ protected: }; public: - enum { rows = ROWS, cols = COLS}; + constexpr static int rows = ROWS; + constexpr static int cols = COLS; typedef RowProxy row_type; typedef row_type const_row_reference; @@ -122,12 +123,12 @@ namespace Arithmetic template<class K, int ROWS, int COLS> struct MatrixTraits<SingleNonZeroRowMatrix<K, ROWS, COLS> > { - enum { isMatrix = true }; - enum { isDense = false }; - enum { sizeIsStatic = true }; //TODO only one of these should be used - enum { hasStaticSize = true }; //TODO only one of these should be used - enum { rows = ROWS}; - enum { cols = COLS}; + constexpr static bool isMatrix = true; + constexpr static bool isDense = false; + constexpr static bool sizeIsStatic = true; // TODO only one of these should be used + constexpr static bool hasStaticSize = true; // TODO only one of these should be used + constexpr static int rows = ROWS; + constexpr static int cols = COLS; }; } diff --git a/dune/matrix-vector/test/resizetest.cc b/dune/matrix-vector/test/resizetest.cc index e3e80f965622ecd45802de35bd201c239e9679ec..59bfc291a7f499a7ae4153660abb95db85204490 100644 --- a/dune/matrix-vector/test/resizetest.cc +++ b/dune/matrix-vector/test/resizetest.cc @@ -31,7 +31,7 @@ struct CustomMultiTypeBlockMatrix : public Dune::MultiTypeBlockMatrix<Args...> { namespace Dune { namespace MatrixVector { template <class... Args> struct MatrixTraits<CustomMultiTypeBlockMatrix<Args...>> { - enum { isMatrix = true }; + constexpr static bool isMatrix = true; }; }} // inject vector identification trait for CustomMultiTypeBlockVector