]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Workaround: Add additional complex ProductTypeImpl specializations
authorMatthias Maier <tamiko@43-1.org>
Sat, 16 May 2020 16:59:00 +0000 (11:59 -0500)
committerMatthias Maier <tamiko@43-1.org>
Sat, 16 May 2020 21:31:20 +0000 (16:31 -0500)
The workaround introduced in 32ecab6 needs an additional variant to
deduce the product type of Tensor<..., complex<Number>> and
complex<Number> correctly.

Co-authored-by: Daniel Arndt <arndtd@ornl.gov>
include/deal.II/base/symmetric_tensor.h
include/deal.II/base/tensor.h

index 164d3740b39ddf5a0e409be7c53f0a59ff493e3e..ea6599ec13c790908c775b655ae9a20979a957fd 100644 (file)
@@ -81,6 +81,17 @@ namespace internal
                       std::complex<typename ProductType<T, U>::type>>;
   };
 
+
+  template <int rank, int dim, typename T, typename U>
+  struct ProductTypeImpl<SymmetricTensor<rank, dim, std::complex<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>>
   {
@@ -90,6 +101,16 @@ namespace internal
                       std::complex<typename ProductType<T, U>::type>>;
   };
 
+  template <int rank, int dim, typename T, typename U>
+  struct ProductTypeImpl<std::complex<T>,
+                         SymmetricTensor<rank, dim, std::complex<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 12877fa9257e9117d2ca80f1fe1ce98dc89b67ff..61435d45a00826f80e7fc8d9718510f435809e7e 100644 (file)
@@ -796,6 +796,13 @@ namespace internal
       Tensor<rank, dim, std::complex<typename ProductType<T, U>::type>>;
   };
 
+  template <int rank, int dim, typename T, typename U>
+  struct ProductTypeImpl<Tensor<rank, dim, std::complex<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>>
   {
@@ -803,6 +810,13 @@ namespace internal
       Tensor<rank, dim, std::complex<typename ProductType<T, U>::type>>;
   };
 
+  template <int rank, int dim, typename T, typename U>
+  struct ProductTypeImpl<std::complex<T>, Tensor<rank, dim, std::complex<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.