From 915f1a2149255096acb297e705e32d2499b017c7 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Tue, 26 Feb 2019 11:58:15 +0100 Subject: [PATCH] Have another namespace inclosing the workaround --- include/deal.II/base/tensor.h | 43 ++++++++++++++++------------------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/include/deal.II/base/tensor.h b/include/deal.II/base/tensor.h index 7b0531ff93..97fa8d608e 100644 --- a/include/deal.II/base/tensor.h +++ b/include/deal.II/base/tensor.h @@ -925,43 +925,38 @@ Tensor<0, dim, Number>::operator-=(const Tensor<0, dim, OtherNumber> &p) -#ifdef __CUDA_ARCH__ namespace internal { - template - DEAL_II_CUDA_HOST_DEV void - multiply_assign_scalar(Number &tensor, const OtherNumber &s) + namespace ComplexWorkaround { - tensor *= s; - } + template + inline DEAL_II_CUDA_HOST_DEV void + multiply_assign_scalar(Number &val, const OtherNumber &s) + { + val *= s; + } - template - DEAL_II_CUDA_HOST_DEV void - multiply_assign_scalar(std::complex &, const OtherNumber &) - { - printf("This function is not implemented for std::complex!\n"); - assert(false); - } +#ifdef __CUDA_ARCH__ + template + inline DEAL_II_CUDA_HOST_DEV void + multiply_assign_scalar(std::complex &, const OtherNumber &) + { + printf("This function is not implemented for std::complex!\n"); + assert(false); + } +#endif + } // namespace ComplexWorkaround } // namespace internal + template template 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 -template -inline DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number> & -Tensor<0, dim, Number>::operator*=(const OtherNumber &s) -{ - value *= s; + internal::ComplexWorkaround::multiply_assign_scalar(value, s); return *this; } -#endif -- 2.39.5