From 9a8062b1c93f47a58702c7d0d4c3a2d0ecb83f6a Mon Sep 17 00:00:00 2001 From: Bruno Turcksin Date: Tue, 25 Aug 2020 14:15:30 +0000 Subject: [PATCH] Fix warnings when using CUDA --- include/deal.II/base/tensor.h | 6 ++++++ include/deal.II/grid/tria_objects.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/deal.II/base/tensor.h b/include/deal.II/base/tensor.h index a2059c6016..eb08d927a5 100644 --- a/include/deal.II/base/tensor.h +++ b/include/deal.II/base/tensor.h @@ -1282,7 +1282,9 @@ constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV const typename Tensor::value_type & Tensor::operator[](const unsigned int i) const { +# ifndef DEAL_II_COMPILER_CUDA_AWARE AssertIndexRange(i, dim); +# endif return values[i]; } @@ -1293,8 +1295,10 @@ DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE const Number & Tensor:: operator[](const TableIndices &indices) const { +# ifndef DEAL_II_COMPILER_CUDA_AWARE Assert(dim != 0, ExcMessage("Cannot access an object of type Tensor")); +# endif return TensorAccessors::extract(*this, indices); } @@ -1305,8 +1309,10 @@ template DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE Number & Tensor::operator[](const TableIndices &indices) { +# ifndef DEAL_II_COMPILER_CUDA_AWARE Assert(dim != 0, ExcMessage("Cannot access an object of type Tensor")); +# endif return TensorAccessors::extract(*this, indices); } diff --git a/include/deal.II/grid/tria_objects.h b/include/deal.II/grid/tria_objects.h index 2f009342db..af9bacb7f0 100644 --- a/include/deal.II/grid/tria_objects.h +++ b/include/deal.II/grid/tria_objects.h @@ -490,7 +490,7 @@ namespace internal inline TriaObjects::TriaObjects() - : structdim(-1) + : structdim(static_cast(-1)) , next_free_single(numbers::invalid_unsigned_int) , next_free_pair(numbers::invalid_unsigned_int) , reverse_order_next_free_single(false) -- 2.39.5