diff --git a/src/amdis/common/StaticSize.hpp b/src/amdis/common/StaticSize.hpp index ec346a0ec753bceebb3f4c2fef67f239ff74a0b0..187880c2b8f11d5a32a6101e3b2335e4941992de 100644 --- a/src/amdis/common/StaticSize.hpp +++ b/src/amdis/common/StaticSize.hpp @@ -25,6 +25,12 @@ namespace Dune class MultiTypeBlockVector; } +namespace Eigen +{ + template <typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols> + class Matrix; +} + namespace AMDiS { namespace Impl @@ -60,6 +66,14 @@ namespace AMDiS struct SizeImpl<Dune::MultiTypeBlockVector<Ts...>> : std::integral_constant<std::size_t, sizeof...(Ts)> {}; + template <class T, int N, int... opts> + struct SizeImpl<Eigen::Matrix<T,N,1,opts...>> + : std::integral_constant<std::size_t, (N >= 0 ? std::size_t(N) : 0u)> {}; + + template <class T, int N, int... opts> + struct SizeImpl<Eigen::Matrix<T,1,N,opts...>> + : std::integral_constant<std::size_t, (N >= 0 ? std::size_t(N) : 0u)> {}; + // Specialization for arithmetic types template <class T> struct SizeImpl<T, std::enable_if_t<std::is_arithmetic<T>::value> > @@ -93,6 +107,10 @@ namespace AMDiS struct RowsImpl<T, std::enable_if_t<std::is_arithmetic<T>::value> > : std::integral_constant<std::size_t, 1> {}; + template <class T, int N, int M, int... opts> + struct RowsImpl<Eigen::Matrix<T,N,M,opts...>> + : std::integral_constant<std::size_t, (N >= 0 ? std::size_t(N) : 0u)> {}; + } // end namespace Impl /// Get the number of rows in a fixed-size matrix @@ -121,6 +139,10 @@ namespace AMDiS struct ColsImpl<T, std::enable_if_t<std::is_arithmetic<T>::value> > : std::integral_constant<std::size_t, 1> {}; + template <class T, int N, int M, int... opts> + struct ColsImpl<Eigen::Matrix<T,N,M,opts...>> + : std::integral_constant<std::size_t, (M >= 0 ? std::size_t(M) : 0u)> {}; + } // end namespace Impl /// Get the number of columns in a fixed-size matrix