10 #ifndef TPETRA_DETAILS_GET1DCONSTVIEW_HPP
11 #define TPETRA_DETAILS_GET1DCONSTVIEW_HPP
18 #include "Tpetra_ConfigDefs.hpp"
20 #include "Kokkos_DualView.hpp"
21 #include <Teuchos_Array.hpp>
35 template <
class ST,
class DT,
36 const bool outputIsHostMemory =
37 std::is_same<typename DT::memory_space, Kokkos::HostSpace>::value>
38 struct Get1DConstViewOfUnmanagedHostArray {};
40 template <
class ST,
class DT>
41 struct Get1DConstViewOfUnmanagedHostArray<ST, DT, true> {
42 typedef Kokkos::View<const ST*, Kokkos::HostSpace, Kokkos::MemoryUnmanaged> output_view_type;
44 static output_view_type
45 getView(
const char [],
const ST* x_raw,
const size_t x_len) {
48 return output_view_type(x_raw, x_len);
52 template <
class ST,
class DT>
53 struct Get1DConstViewOfUnmanagedHostArray<ST, DT, false> {
54 typedef Kokkos::View<const ST*, Kokkos::HostSpace, Kokkos::MemoryUnmanaged> input_view_type;
55 typedef Kokkos::View<const ST*, DT> output_view_type;
57 static output_view_type
58 getView(
const char label[],
const ST* x_raw,
const size_t x_len) {
59 input_view_type x_in(x_raw, x_len);
66 Kokkos::View<ST*, DT> x_out(std::string(label), x_len);
73 template <
class ST,
class DT>
74 typename Get1DConstViewOfUnmanagedHostArray<ST, DT>::output_view_type
75 get1DConstViewOfUnmanagedHostArray(
const char label[],
const ST* x_raw,
const size_t x_len) {
76 return Get1DConstViewOfUnmanagedHostArray<ST, DT>::getView(label, x_raw, x_len);
82 #endif // TPETRA_DETAILS_GET1DCONSTVIEW_HPP
void deep_copy(MultiVector< DS, DL, DG, DN > &dst, const MultiVector< SS, SL, SG, SN > &src)
Copy the contents of the MultiVector src into dst.
Stand-alone utility functions and macros.