]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Work around nvcc_wrapper std::complex problem
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 23 Feb 2019 23:50:41 +0000 (00:50 +0100)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Mon, 25 Feb 2019 12:14:58 +0000 (13:14 +0100)
include/deal.II/base/tensor.h

index b299ed09a7563544f65a6ae03e02be3ad6cd480a..7b0531ff931293554b607b5d48b4dd2f7cdbb5f1 100644 (file)
@@ -924,6 +924,35 @@ Tensor<0, dim, Number>::operator-=(const Tensor<0, dim, OtherNumber> &p)
 }
 
 
+
+#ifdef __CUDA_ARCH__
+namespace internal
+{
+  template <typename Number, typename OtherNumber>
+  DEAL_II_CUDA_HOST_DEV void
+  multiply_assign_scalar(Number &tensor, const OtherNumber &s)
+  {
+    tensor *= s;
+  }
+
+  template <typename Number, typename OtherNumber>
+  DEAL_II_CUDA_HOST_DEV void
+  multiply_assign_scalar(std::complex<Number> &, const OtherNumber &)
+  {
+    printf("This function is not implemented for std::complex<Number>!\n");
+    assert(false);
+  }
+} // namespace internal
+
+template <int dim, typename Number>
+template <typename OtherNumber>
+inline DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number> &
+Tensor<0, dim, Number>::operator*=(const OtherNumber &s)
+{
+  internal::multiply_assign_scalar(value, s);
+  return *this;
+}
+#else
 template <int dim, typename Number>
 template <typename OtherNumber>
 inline DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number> &
@@ -932,6 +961,8 @@ Tensor<0, dim, Number>::operator*=(const OtherNumber &s)
   value *= s;
   return *this;
 }
+#endif
+
 
 
 template <int dim, typename Number>

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.