]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add cross_product_3d between std::complex<number> and number
authorDaniel Garcia-Sanchez <daniel.garcia-sanchez@insp.upmc.fr>
Sat, 22 Jun 2019 07:08:29 +0000 (09:08 +0200)
committerDaniel Garcia-Sanchez <daniel.garcia-sanchez@insp.upmc.fr>
Sat, 22 Jun 2019 07:08:29 +0000 (09:08 +0200)
include/deal.II/base/tensor.h

index f6690804b310f42904fdefba791a061535dd34fd..d0a350fc8d1cfd57d572a454a561f768a6f90272 100644 (file)
@@ -2095,14 +2095,15 @@ inline DEAL_II_ALWAYS_INLINE Tensor<1, dim, Number>
  * @relatesalso Tensor
  * @author Guido Kanschat, 2001
  */
-template <int dim, typename Number>
-inline DEAL_II_ALWAYS_INLINE Tensor<1, dim, Number>
-                             cross_product_3d(const Tensor<1, dim, Number> &src1,
-                                              const Tensor<1, dim, Number> &src2)
+template <int dim, typename Number1, typename Number2>
+inline DEAL_II_ALWAYS_INLINE
+  Tensor<1, dim, typename ProductType<Number1, Number2>::type>
+  cross_product_3d(const Tensor<1, dim, Number1> &src1,
+                   const Tensor<1, dim, Number2> &src2)
 {
   Assert(dim == 3, ExcInternalError());
 
-  Tensor<1, dim, Number> result;
+  Tensor<1, dim, typename ProductType<Number1, Number2>::type> result;
 
   result[0] = src1[1] * src2[2] - src1[2] * src2[1];
   result[1] = src1[2] * src2[0] - src1[0] * src2[2];

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.