42 #ifndef TPETRA_DETAILS_GET1DCONSTVIEW_HPP
43 #define TPETRA_DETAILS_GET1DCONSTVIEW_HPP
50 #include "Tpetra_ConfigDefs.hpp"
52 #include "Kokkos_DualView.hpp"
53 #include <Teuchos_Array.hpp>
67 template<
class ST,
class DT,
68 const bool outputIsHostMemory =
69 std::is_same<typename DT::memory_space, Kokkos::HostSpace>::value>
70 struct Get1DConstViewOfUnmanagedHostArray {};
72 template<
class ST,
class DT>
73 struct Get1DConstViewOfUnmanagedHostArray<ST, DT, true> {
74 typedef Kokkos::View<const ST*, Kokkos::HostSpace, Kokkos::MemoryUnmanaged> output_view_type;
76 static output_view_type
77 getView (
const char [],
const ST* x_raw,
const size_t x_len)
81 return output_view_type (x_raw, x_len);
85 template<
class ST,
class DT>
86 struct Get1DConstViewOfUnmanagedHostArray<ST, DT, false> {
87 typedef Kokkos::View<const ST*, Kokkos::HostSpace, Kokkos::MemoryUnmanaged> input_view_type;
88 typedef Kokkos::View<const ST*, DT> output_view_type;
90 static output_view_type
91 getView (
const char label[],
const ST* x_raw,
const size_t x_len)
93 input_view_type x_in (x_raw, x_len);
100 Kokkos::View<ST*, DT> x_out (std::string (label), x_len);
106 template<
class ST,
class DT>
107 typename Get1DConstViewOfUnmanagedHostArray<ST, DT>::output_view_type
108 get1DConstViewOfUnmanagedHostArray (
const char label[],
const ST* x_raw,
const size_t x_len)
110 return Get1DConstViewOfUnmanagedHostArray<ST, DT>::getView (label, x_raw, x_len);
116 #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.