]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Bugfix: Promote VectorizedArray<Number> to a scalar type
authorMatthias Maier <tamiko@43-1.org>
Thu, 3 Sep 2015 04:15:06 +0000 (23:15 -0500)
committerMatthias Maier <tamiko@43-1.org>
Mon, 7 Sep 2015 18:36:22 +0000 (13:36 -0500)
Now, every operation concerning Tensors are guarded with the EnableIfScalar
type trait. Consequently, a VectorizedArray has also to be made a scalar
type.

include/deal.II/base/vectorization.h

index 1a34d8bb41b2e12a43a57070ac3454cd33601879..066905e958803657de1b2a104414d5dd351c74da 100644 (file)
 
 // forward declarations
 DEAL_II_NAMESPACE_OPEN
-
 template <typename Number> class VectorizedArray;
-
+template <typename T> struct EnableIfScalar;
 DEAL_II_NAMESPACE_CLOSE
 
+
 namespace std
 {
   template <typename Number> ::dealii::VectorizedArray<Number>
@@ -65,9 +65,19 @@ namespace std
 }
 
 
-
 DEAL_II_NAMESPACE_OPEN
 
+
+// Enable the EnableIfScalar type trait for VectorizedArray<Number> such
+// that it can be used as a Number type in Tensor<rank,dim,Number>, etc.
+
+template<typename Number>
+struct EnableIfScalar<VectorizedArray<Number> >
+{
+  typedef VectorizedArray<typename EnableIfScalar<Number>::type> type;
+};
+
+
 /**
  * This generic class defines a unified interface to a vectorized data type.
  * For general template arguments, this class simply corresponds to the

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.