]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix SymmetricTensor and Tensor ProductType 9456/head
authorJean-Paul Pelteret <jppelteret@gmail.com>
Sat, 1 Feb 2020 19:00:04 +0000 (20:00 +0100)
committerJean-Paul Pelteret <jppelteret@gmail.com>
Sat, 1 Feb 2020 20:50:25 +0000 (21:50 +0100)
Fixes a compiler error on the old Apple Clang 8.0.0 compiler, where the product type between complex numbers and tensors could not be determined.

include/deal.II/base/symmetric_tensor.h
include/deal.II/base/tensor.h

index ca531dfa5f84783e110642da8742c0b4f33c839c..f90e3e4d79978f1b467880b8c9c99d0b33984933 100644 (file)
@@ -72,6 +72,24 @@ DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE Number
 
 namespace internal
 {
+  template <int rank, int dim, typename T, typename U>
+  struct ProductTypeImpl<SymmetricTensor<rank, dim, T>, std::complex<U>>
+  {
+    using type =
+      SymmetricTensor<rank,
+                      dim,
+                      std::complex<typename ProductType<T, U>::type>>;
+  };
+
+  template <typename T, int rank, int dim, typename U>
+  struct ProductTypeImpl<std::complex<T>, SymmetricTensor<rank, dim, U>>
+  {
+    using type =
+      SymmetricTensor<rank,
+                      dim,
+                      std::complex<typename ProductType<T, U>::type>>;
+  };
+
   /**
    * A namespace for functions and classes that are internal to how the
    * SymmetricTensor class (and its associate functions) works.
index a1fbcdc4b8593f993ba69b88cb1bfee4c5841a60..a1952271f15163766a95ffee9617e526cc685a84 100644 (file)
@@ -755,6 +755,20 @@ private:
 
 namespace internal
 {
+  template <int rank, int dim, typename T, typename U>
+  struct ProductTypeImpl<Tensor<rank, dim, T>, std::complex<U>>
+  {
+    using type =
+      Tensor<rank, dim, std::complex<typename ProductType<T, U>::type>>;
+  };
+
+  template <typename T, int rank, int dim, typename U>
+  struct ProductTypeImpl<std::complex<T>, Tensor<rank, dim, U>>
+  {
+    using type =
+      Tensor<rank, dim, std::complex<typename ProductType<T, U>::type>>;
+  };
+
   /**
    * The structs below are needed to initialize nested Tensor objects.
    * Also see numbers.h for another specialization.

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.