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)
49 return output_view_type (x_raw, x_len);
53 template<
class ST,
class DT>
54 struct Get1DConstViewOfUnmanagedHostArray<ST, DT, false> {
55 typedef Kokkos::View<const ST*, Kokkos::HostSpace, Kokkos::MemoryUnmanaged> input_view_type;
56 typedef Kokkos::View<const ST*, DT> output_view_type;
58 static output_view_type
59 getView (
const char label[],
const ST* x_raw,
const size_t x_len)
61 input_view_type x_in (x_raw, x_len);
68 Kokkos::View<ST*, DT> x_out (std::string (label), x_len);
75 template<
class ST,
class DT>
76 typename Get1DConstViewOfUnmanagedHostArray<ST, DT>::output_view_type
77 get1DConstViewOfUnmanagedHostArray (
const char label[],
const ST* x_raw,
const size_t x_len)
79 return Get1DConstViewOfUnmanagedHostArray<ST, DT>::getView (label, x_raw, x_len);
85 #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.