Skip to content
Snippets Groups Projects
Commit bbfea55f authored by Tobias Leibner's avatar Tobias Leibner
Browse files

[container] fix tests

parent 0471fbc1
No related branches found
No related tags found
No related merge requests found
...@@ -287,8 +287,10 @@ public: ...@@ -287,8 +287,10 @@ public:
} }
template <class V1, class V2> template <class V1, class V2>
inline std::enable_if_t<XT::Common::is_vector<V1>::value && XT::Common::is_vector<V2>::value, void> mv(const V1& xx, inline std::enable_if_t<XT::Common::is_vector<V1>::value && XT::Common::is_vector<V2>::value
V2& yy) const && !is_eigen_vector<V1>::value,
void>
mv(const V1& xx, V2& yy) const
{ {
EigenDenseVector<ScalarType> xx_eigen(xx.size()), yy_eigen(yy.size()); EigenDenseVector<ScalarType> xx_eigen(xx.size()), yy_eigen(yy.size());
for (size_t ii = 0; ii < xx.size(); ++ii) for (size_t ii = 0; ii < xx.size(); ++ii)
...@@ -305,8 +307,10 @@ public: ...@@ -305,8 +307,10 @@ public:
} }
template <class V1, class V2> template <class V1, class V2>
inline std::enable_if_t<XT::Common::is_vector<V1>::value && XT::Common::is_vector<V2>::value, void> mtv(const V1& xx, inline std::enable_if_t<XT::Common::is_vector<V1>::value && XT::Common::is_vector<V2>::value
V2& yy) const && !is_eigen_vector<V1>::value,
void>
mtv(const V1& xx, V2& yy) const
{ {
EigenDenseVector<ScalarType> xx_eigen(xx.size()), yy_eigen(yy.size()); EigenDenseVector<ScalarType> xx_eigen(xx.size()), yy_eigen(yy.size());
for (size_t ii = 0; ii < xx.size(); ++ii) for (size_t ii = 0; ii < xx.size(); ++ii)
......
...@@ -552,8 +552,10 @@ public: ...@@ -552,8 +552,10 @@ public:
} }
template <class V1, class V2> template <class V1, class V2>
inline std::enable_if_t<XT::Common::is_vector<V1>::value && XT::Common::is_vector<V2>::value, void> mv(const V1& xx, inline std::enable_if_t<XT::Common::is_vector<V1>::value && XT::Common::is_vector<V2>::value
V2& yy) const && !is_istl_dense_vector<V1>::value,
void>
mv(const V1& xx, V2& yy) const
{ {
IstlDenseVector<ScalarType> xx_istl(xx.size()), yy_istl(yy.size()); IstlDenseVector<ScalarType> xx_istl(xx.size()), yy_istl(yy.size());
for (size_t ii = 0; ii < xx.size(); ++ii) for (size_t ii = 0; ii < xx.size(); ++ii)
...@@ -570,8 +572,10 @@ public: ...@@ -570,8 +572,10 @@ public:
} }
template <class V1, class V2> template <class V1, class V2>
inline std::enable_if_t<XT::Common::is_vector<V1>::value && XT::Common::is_vector<V2>::value, void> mtv(const V1& xx, inline std::enable_if_t<XT::Common::is_vector<V1>::value && XT::Common::is_vector<V2>::value
V2& yy) const && !is_istl_dense_vector<V1>::value,
void>
mtv(const V1& xx, V2& yy) const
{ {
IstlDenseVector<ScalarType> xx_istl(xx.size()), yy_istl(yy.size()); IstlDenseVector<ScalarType> xx_istl(xx.size()), yy_istl(yy.size());
for (size_t ii = 0; ii < xx.size(); ++ii) for (size_t ii = 0; ii < xx.size(); ++ii)
......
...@@ -55,6 +55,12 @@ class VectorInterface; ...@@ -55,6 +55,12 @@ class VectorInterface;
template <class ScalarType, Backends backend> template <class ScalarType, Backends backend>
struct Container; struct Container;
template <class Traits, class ScalarImp>
class EigenBaseVector;
template <class ScalarImp>
class IstlDenseVector;
namespace internal { namespace internal {
...@@ -108,6 +114,25 @@ struct is_vector_helper ...@@ -108,6 +114,25 @@ struct is_vector_helper
}; // class is_vector_helper }; // class is_vector_helper
template <class C>
struct is_eigen_vector_helper
{
DXTC_has_typedef_initialize_once(Traits);
DXTC_has_typedef_initialize_once(ScalarType);
static const bool is_candidate = DXTC_has_typedef(Traits)<C>::value && DXTC_has_typedef(ScalarType)<C>::value;
}; // class is_eigen_vector_helper
template <class C>
struct is_istl_dense_vector_helper
{
DXTC_has_typedef_initialize_once(ScalarType);
static const bool is_candidate = DXTC_has_typedef(ScalarType)<C>::value;
}; // class is_istl_dense_vector_helper
} // namespace internal } // namespace internal
...@@ -138,6 +163,24 @@ struct is_vector<V, false> : public std::false_type ...@@ -138,6 +163,24 @@ struct is_vector<V, false> : public std::false_type
{}; {};
template <class V, bool candidate = internal::is_eigen_vector_helper<V>::is_candidate>
struct is_eigen_vector : public std::is_base_of<EigenBaseVector<typename V::Traits, typename V::ScalarType>, V>
{};
template <class V>
struct is_eigen_vector<V, false> : public std::false_type
{};
template <class V, bool candidate = internal::is_istl_dense_vector_helper<V>::is_candidate>
struct is_istl_dense_vector : public std::is_base_of<IstlDenseVector<typename V::ScalarType>, V>
{};
template <class V>
struct is_istl_dense_vector<V, false> : public std::false_type
{};
template <class C, bool candidate = internal::provides_backend_helper<C>::is_candidate> template <class C, bool candidate = internal::provides_backend_helper<C>::is_candidate>
struct provides_backend : public std::is_base_of<ProvidesBackend<typename C::Traits>, C> struct provides_backend : public std::is_base_of<ProvidesBackend<typename C::Traits>, C>
{}; {};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment