]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Always allow accessing data in ArrayView
authorDaniel Arndt <arndtd@ornl.gov>
Wed, 4 Jan 2023 11:20:51 +0000 (12:20 +0100)
committerDaniel Arndt <arndtd@ornl.gov>
Wed, 4 Jan 2023 11:20:51 +0000 (12:20 +0100)
include/deal.II/base/array_view.h
tests/base/array_view_access_data.cc [deleted file]
tests/base/array_view_access_data.debug.output [deleted file]

index 168310404e1716c1c36679d98f43775334e1b14b..e7677221099af52b1701a6299cb01a75ab73f9c1 100644 (file)
@@ -575,10 +575,6 @@ inline typename ArrayView<ElementType, MemorySpaceType>::value_type &
 ArrayView<ElementType, MemorySpaceType>::operator[](const std::size_t i) const
 {
   AssertIndexRange(i, n_elements);
-  Assert(
-    (std::is_same<MemorySpaceType, MemorySpace::Host>::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 (file)
index ea48eba..0000000
+++ /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 <deal.II/base/array_view.h>
-
-#include "../tests.h"
-
-int
-main(int argc, char **argv)
-{
-  deal_II_exceptions::disable_abort_on_exception();
-
-  initlog();
-
-  Kokkos::ScopeGuard                                               guard;
-  Kokkos::View<unsigned int *, MemorySpace::Default::kokkos_space> dummy(
-    "dummy", 2);
-
-  try
-    {
-      ArrayView<unsigned int, MemorySpace::Default> 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 (file)
index af6a2ed..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-
-DEAL::
---------------------------------------------------------
-An error occurred in file <array_view.h> in function
-    dealii::ArrayView<ElementType, MemorySpace>::value_type& dealii::ArrayView<ElementType, MemorySpace>::operator[](std::size_t) const [with ElementType = unsigned int; MemorySpaceType = dealii::MemorySpace::Default; dealii::ArrayView<ElementType, MemorySpace>::value_type = unsigned int; std::size_t = long unsigned int]
-The violated condition was: 
-    (std::is_same<MemorySpaceType, MemorySpace::Host>::value)
-Additional information: 
-    Accessing elements is only allowed if the data is stored in CPU
-    memory!
---------------------------------------------------------
-

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.