10#ifndef TPETRA_DETAILS_GETENTRYONHOST_HPP
11#define TPETRA_DETAILS_GETENTRYONHOST_HPP
19#include "TpetraCore_config.h"
20#include "Kokkos_Core.hpp"
25template <
class ViewType,
27typename ViewType::non_const_value_type
28getEntryOnHost(
const ViewType& x,
29 const IndexType ind) {
30 using execution_space =
typename ViewType::execution_space;
31 static_assert(ViewType::rank == 1,
"x must be a rank-1 Kokkos::View.");
33 typename ViewType::non_const_value_type val;
35 Kokkos::deep_copy(execution_space(), val, Kokkos::subview(x, ind));
39template <
class ViewType,
41typename ViewType::host_mirror_type::const_type
42getEntriesOnHost(
const ViewType& x,
45 static_assert(ViewType::rank == 1,
"x must be a rank-1 Kokkos::View.");
47 auto subview = Kokkos::subview(x, Kokkos::make_pair(ind, ind + count));
48 return Kokkos::create_mirror_view_and_copy(
typename ViewType::host_mirror_type::memory_space(), subview);
Implementation details of Tpetra.
Namespace Tpetra contains the class and methods constituting the Tpetra library.