From 4e05f9af254982b959ddea239748684a797ce87a Mon Sep 17 00:00:00 2001
From: Max Kahnt <max.kahnt@fu-berlin.de>
Date: Sat, 30 Sep 2017 15:02:06 +0200
Subject: [PATCH] Add vector traits.

---
 dune/matrix-vector/vectortraits.hh | 33 ++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 dune/matrix-vector/vectortraits.hh

diff --git a/dune/matrix-vector/vectortraits.hh b/dune/matrix-vector/vectortraits.hh
new file mode 100644
index 0000000..e505a7e
--- /dev/null
+++ b/dune/matrix-vector/vectortraits.hh
@@ -0,0 +1,33 @@
+#ifndef DUNE_MATRIX_VECTOR_VECTORTRAITS_HH
+#define DUNE_MATRIX_VECTOR_VECTORTRAITS_HH
+
+#include <dune/common/fvector.hh>
+#include <dune/istl/bvector.hh>
+#include <dune/istl/multitypeblockvector.hh>
+
+namespace Dune {
+namespace MatrixVector {
+
+/** \brief Class to identify vector types and extract information
+ *
+ * Specialize this class for all types that can be used like a vector.
+ */
+template <class T>
+struct VectorTraits {
+  constexpr static bool isVector = false;
+};
+
+template <class K, int n>
+struct VectorTraits<FieldVector<K, n>> {
+  constexpr static bool isVector = true;
+};
+
+template <class Block>
+struct VectorTraits<BlockVector<Block>> {
+  constexpr static bool isVector = true;
+};
+
+} // end namespace MatrixVector
+} // end namespace Dune
+
+#endif // DUNE_MATRIX_VECTOR_VECTORTRAITS_HH
-- 
GitLab