Skip to content
Snippets Groups Projects
Commit 35255bb2 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

add static size information for Eigen matrix type

parent f194064a
No related branches found
No related tags found
1 merge request!50add static size information for Eigen matrix type
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment