7 #include <dune/common/typeutilities.hh> 8 #include <amdis/common/TypeTraits.hpp> 11 #include <boost/numeric/mtl/operation/static_size.hpp> 18 template <
class Container>
24 static constexpr
auto eval(T
const&, Dune::PriorityTag<6>)
25 -> decltype(std::integral_constant<std::size_t,(mtl::static_num_rows<T>::value * mtl::static_num_cols<T>::value)>{})
33 static constexpr
auto eval(T
const&, Dune::PriorityTag<5>)
34 -> decltype(std::integral_constant<std::size_t,T::SizeAtCompileTime>{})
41 static constexpr
auto eval(T
const&, Dune::PriorityTag<4>)
42 -> decltype(std::integral_constant<std::size_t,std::tuple_size<T>::value>{})
49 static constexpr
auto eval(T
const&, Dune::PriorityTag<3>)
50 -> decltype(std::integral_constant<std::size_t,T::dimension>{})
57 static constexpr
auto eval(T
const&, Dune::PriorityTag<2>)
58 -> decltype(std::integral_constant<std::size_t,(T::rows * T::cols)>{})
65 static constexpr
auto eval(T
const&, Dune::PriorityTag<1>)
66 -> decltype(std::integral_constant<std::size_t,T::size()>{})
73 static constexpr
auto eval(T
const&, Dune::PriorityTag<0>)
74 -> decltype(std::integral_constant<std::size_t, (std::is_arithmetic_v<T> ? 1 : 0)>{})
79 static constexpr
auto eval(Container
const& container)
81 return eval(container, Dune::PriorityTag<42>{});
98 template <
class Container>
101 return Impl::SizeImpl<Container>::eval(container);
104 template <
class Container>
105 constexpr std::size_t static_size_v
108 template <
class T, std::
size_t S0, std::
size_t S1 = static_size_v<T>>
111 static_assert(S0 == S1,
"Non-matching size");
117 template <
class Matrix>
123 static constexpr
auto eval(T
const&, Dune::PriorityTag<4>)
124 -> decltype(std::integral_constant<std::size_t,mtl::static_num_rows<T>::value>{})
132 static constexpr
auto eval(T
const&, Dune::PriorityTag<3>)
133 -> decltype(std::integral_constant<std::size_t,T::RowsAtCompileTime>{})
140 static constexpr
auto eval(T
const&, Dune::PriorityTag<2>)
141 -> decltype(std::integral_constant<std::size_t,T::rows>{})
148 static constexpr
auto eval(T
const&, Dune::PriorityTag<1>)
149 -> decltype(std::integral_constant<std::size_t,T::N()>{})
156 static constexpr
auto eval(T
const&, Dune::PriorityTag<0>)
157 -> decltype(std::integral_constant<std::size_t, (std::is_arithmetic_v<T> ? 1 : 0)>{})
162 static constexpr
auto eval(Matrix
const& matrix)
164 return eval(matrix, Dune::PriorityTag<42>{});
181 template <
class Matrix>
184 return Impl::NumRowsImpl<Matrix>::eval(matrix);
187 template <
class Matrix>
188 constexpr std::size_t static_num_rows_v
191 template <
class T, std::
size_t S0, std::
size_t S1 = static_num_rows<T>>
194 static_assert(S0 == S1,
"Non-matching num rows");
199 template <
class Matrix>
205 static constexpr
auto eval(T
const&, Dune::PriorityTag<4>)
206 -> decltype(std::integral_constant<std::size_t,mtl::static_num_cols<T>::value>{})
214 static constexpr
auto eval(T
const&, Dune::PriorityTag<3>)
215 -> decltype(std::integral_constant<std::size_t,T::ColsAtCompileTime>{})
222 static constexpr
auto eval(T
const&, Dune::PriorityTag<2>)
223 -> decltype(std::integral_constant<std::size_t,T::cols>{})
230 static constexpr
auto eval(T
const&, Dune::PriorityTag<1>)
231 -> decltype(std::integral_constant<std::size_t,T::M()>{})
238 static constexpr
auto eval(T
const&, Dune::PriorityTag<0>)
239 -> decltype(std::integral_constant<std::size_t, (std::is_arithmetic_v<T> ? 1 : 0)>{})
244 static constexpr
auto eval(Matrix
const& matrix)
246 return eval(matrix, Dune::PriorityTag<42>{});
263 template <
class Matrix>
266 return Impl::NumColsImpl<Matrix>::eval(matrix);
269 template <
class Matrix>
270 constexpr std::size_t static_num_cols_v
273 template <
class T, std::
size_t S0, std::
size_t S1 = static_num_cols<T>>
276 static_assert(S0 == S1,
"Non-matching num rows");
typename remove_cvref< T >::type remove_cvref_t
Helper alias template for remove_cvref.
Definition: TypeTraits.hpp:24
Contains all classes needed for solving linear and non linear equation systems.
Definition: AdaptBase.hpp:6
constexpr auto static_size(Container const &container)
Return a static constant size of the container.
Definition: StaticSize.hpp:99
Definition: StaticSize.hpp:274
constexpr auto static_num_rows(Matrix const &matrix)
Return a static constant rows of the matrix.
Definition: StaticSize.hpp:182
constexpr auto static_num_cols(Matrix const &matrix)
Return a static constant columns of the matrix.
Definition: StaticSize.hpp:264
Definition: StaticSize.hpp:109
Definition: StaticSize.hpp:192