From e8765bbc53bef4fb742e1c6022c2873788d3ccf2 Mon Sep 17 00:00:00 2001
From: Daniel Arndt <arndtd@ornl.gov>
Date: Sat, 23 Nov 2019 15:19:33 -0500
Subject: [PATCH] Minor consistency improvements in tensor.h

---
 include/deal.II/base/tensor.h | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/include/deal.II/base/tensor.h b/include/deal.II/base/tensor.h
index 1a2c710c30..ea4917676c 100644
--- a/include/deal.II/base/tensor.h
+++ b/include/deal.II/base/tensor.h
@@ -1142,15 +1142,19 @@ namespace internal
     Type Uninitialized<Type>::value;
 
     template <typename ArrayElementType>
-    DEAL_II_CONSTEXPR inline ArrayElementType &
-    subscript(ArrayElementType *,
-              const unsigned int,
-              std::integral_constant<int, 0>)
+    DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+      DEAL_II_CUDA_HOST_DEV ArrayElementType &
+                            subscript(ArrayElementType *,
+                                      const unsigned int,
+                                      std::integral_constant<int, 0>)
     {
+      // We cannot use Assert in a CUDA kernel
+#ifndef __CUDA_ARCH__
       Assert(
         false,
         ExcMessage(
           "Cannot access elements of an object of type Tensor<rank,0,Number>."));
+#endif
       return Uninitialized<ArrayElementType>::value;
     }
   } // namespace TensorSubscriptor
@@ -1158,7 +1162,7 @@ namespace internal
 
 
 template <int rank_, int dim, typename Number>
-DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE     DEAL_II_CUDA_HOST_DEV //
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE     DEAL_II_CUDA_HOST_DEV
   typename Tensor<rank_, dim, Number>::value_type &Tensor<rank_, dim, Number>::
                                                    operator[](const unsigned int i)
 {
@@ -1375,7 +1379,7 @@ namespace internal
                   std::is_same<Number, Differentiation::SD::Expression>::value,
                 int>::type = 0>
     DEAL_II_CONSTEXPR DEAL_II_CUDA_HOST_DEV inline DEAL_II_ALWAYS_INLINE void
-                      division_operator(dealii::Tensor<rank, dim, Number> (&t)[dim],
+                      division_operator(Tensor<rank, dim, Number> (&t)[dim],
                                         const OtherNumber &factor)
     {
       // recurse over the base objects
-- 
2.39.5