42#ifndef TPETRA_DETAILS_GETENTRYONHOST_HPP
43#define TPETRA_DETAILS_GETENTRYONHOST_HPP
51#include "TpetraCore_config.h"
52#include "Kokkos_Core.hpp"
57template<
class ViewType,
59typename ViewType::non_const_value_type
60getEntryOnHost (
const ViewType& x,
63 using execution_space =
typename ViewType::execution_space;
64 static_assert (ViewType::Rank == 1,
"x must be a rank-1 Kokkos::View.");
66 typename ViewType::non_const_value_type val;
68 Kokkos::deep_copy(execution_space(), val, Kokkos::subview(x, ind));
72template<
class ViewType,
74typename ViewType::HostMirror::const_type
75getEntriesOnHost (
const ViewType& x,
79 static_assert (ViewType::Rank == 1,
"x must be a rank-1 Kokkos::View.");
81 auto subview = Kokkos::subview(x, Kokkos::make_pair(ind, ind + count));
82 return Kokkos::create_mirror_view_and_copy(
typename ViewType::HostMirror::memory_space(), subview);
Implementation details of Tpetra.
Namespace Tpetra contains the class and methods constituting the Tpetra library.