From 8ca33c71b99ba022775313639b247f3cf7cf1039 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Wed, 4 Jan 2023 12:20:51 +0100 Subject: [PATCH] Always allow accessing data in ArrayView --- include/deal.II/base/array_view.h | 4 -- tests/base/array_view_access_data.cc | 46 ------------------- .../base/array_view_access_data.debug.output | 12 ----- 3 files changed, 62 deletions(-) delete mode 100644 tests/base/array_view_access_data.cc delete mode 100644 tests/base/array_view_access_data.debug.output diff --git a/include/deal.II/base/array_view.h b/include/deal.II/base/array_view.h index 168310404e..e767722109 100644 --- a/include/deal.II/base/array_view.h +++ b/include/deal.II/base/array_view.h @@ -575,10 +575,6 @@ inline typename ArrayView::value_type & ArrayView::operator[](const std::size_t i) const { AssertIndexRange(i, n_elements); - Assert( - (std::is_same::value), - ExcMessage( - "Accessing elements is only allowed if the data is stored in CPU memory!")); return *(starting_element + i); } diff --git a/tests/base/array_view_access_data.cc b/tests/base/array_view_access_data.cc deleted file mode 100644 index ea48eba175..0000000000 --- a/tests/base/array_view_access_data.cc +++ /dev/null @@ -1,46 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2018 by the deal.II authors -// -// This file is part of the deal.II library. -// -// The deal.II library is free software; you can use it, redistribute -// it, and/or modify it under the terms of the GNU Lesser General -// Public License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// The full text of the license can be found in the file LICENSE.md at -// the top level directory of deal.II. -// -// --------------------------------------------------------------------- - - -// check that we detect that accessing memory in MemorySpace::Default using an -// ArrayView object is not allowed. - -#include - -#include "../tests.h" - -int -main(int argc, char **argv) -{ - deal_II_exceptions::disable_abort_on_exception(); - - initlog(); - - Kokkos::ScopeGuard guard; - Kokkos::View dummy( - "dummy", 2); - - try - { - ArrayView view(dummy.data(), 2); - const auto dummy = view[0]; - } - catch (const ExceptionBase &exc) - { - deallog << exc.what() << std::endl; - } - - return 0; -} diff --git a/tests/base/array_view_access_data.debug.output b/tests/base/array_view_access_data.debug.output deleted file mode 100644 index af6a2ed078..0000000000 --- a/tests/base/array_view_access_data.debug.output +++ /dev/null @@ -1,12 +0,0 @@ - -DEAL:: --------------------------------------------------------- -An error occurred in file in function - dealii::ArrayView::value_type& dealii::ArrayView::operator[](std::size_t) const [with ElementType = unsigned int; MemorySpaceType = dealii::MemorySpace::Default; dealii::ArrayView::value_type = unsigned int; std::size_t = long unsigned int] -The violated condition was: - (std::is_same::value) -Additional information: - Accessing elements is only allowed if the data is stored in CPU - memory! --------------------------------------------------------- - -- 2.39.5