1 #ifndef MY_MIRROR_VIEW_HPP
2 #define MY_MIRROR_VIEW_HPP
13 template<
class Device,
typename T>
14 View<T*,CLayout,Device>
my_mirror_view(
const View<T*,CLayout,Device>& view, Device nd){
18 template<
class NewDevice,
class Device,
typename T>
19 View<T*,CLayout,NewDevice>
my_mirror_view(
const View<T*,CLayout,Device>& view, NewDevice nd){
20 return View<T*,CLayout,NewDevice>(
NoInit(
"mirror"), view.layout());
27 template<
class Device,
typename T>
28 View<T*,CLayout,Device>
my_mirror_view(
const View<T*,CLayout,Device>& view, Device nd,
const View<T*,CLayout,Device> scratch_view){
32 template<
class NewDevice,
class Device,
typename T>
33 View<T*,CLayout,NewDevice>
my_mirror_view(
const View<T*,CLayout,Device>& view, NewDevice nd,
const View<T*,CLayout,NewDevice> scratch_view){
41 template<
class Device,
typename T>
42 View<T**,CLayout,Device>
my_mirror_view(
const View<T**,CLayout,Device>& view, Device nd){
46 template<
class NewDevice,
class Device,
typename T>
47 View<T**,CLayout,NewDevice>
my_mirror_view(
const View<T**,CLayout,Device>& view, NewDevice nd){
48 return View<T**,CLayout,NewDevice>(
NoInit(
"mirror"), view.layout());
55 template<
class Device,
typename T>
56 View<T**,CLayout,Device>
my_mirror_view(
const View<T**,CLayout,Device>& view, Device nd,
const View<T**,CLayout,Device> scratch_view){
60 template<
class NewDevice,
class Device,
typename T>
61 View<T**,CLayout,NewDevice>
my_mirror_view(
const View<T**,CLayout,Device>& view, NewDevice nd,
const View<T**,CLayout,NewDevice> scratch_view){
69 template<
class Device,
typename T,
typename T2>
70 View<T*,CLayout,Device, Kokkos::MemoryTraits<Kokkos::Unmanaged>>
my_mirror_view(
const View<T*,
CLayout,Device, Kokkos::MemoryTraits<Kokkos::Unmanaged>>& view, Device nd,
const T2& scratch_view){
74 template<
class NewDevice,
class Device,
typename T,
typename T2>
75 View<T*,CLayout,NewDevice, Kokkos::MemoryTraits<Kokkos::Unmanaged>>
my_mirror_view(
const View<T*,
CLayout,Device, Kokkos::MemoryTraits<Kokkos::Unmanaged>>& view, NewDevice nd,
const T2& scratch_view){
76 return View<T*,CLayout,NewDevice, Kokkos::MemoryTraits<Kokkos::Unmanaged>>(scratch_view.data(), view.layout());
83 template<
class Device,
typename T,
typename T2>
84 View<T**,CLayout,Device, Kokkos::MemoryTraits<Kokkos::Unmanaged>>
my_mirror_view(
const View<T**,
CLayout,Device, Kokkos::MemoryTraits<Kokkos::Unmanaged>>& view, Device nd,
const T2& scratch_view){
88 template<
class NewDevice,
class Device,
typename T,
typename T2>
89 View<T**,CLayout,NewDevice, Kokkos::MemoryTraits<Kokkos::Unmanaged>>
my_mirror_view(
const View<T**,
CLayout,Device, Kokkos::MemoryTraits<Kokkos::Unmanaged>>& view, NewDevice nd,
const T2& scratch_view){
90 return View<T**,CLayout,NewDevice, Kokkos::MemoryTraits<Kokkos::Unmanaged>>(scratch_view.data(), view.layout());
96 template<
class Device,
typename T>
98 return View<T*,CLayout,Device>();
101 template<
class NewDevice,
class Device,
typename T>
103 return View<T*,CLayout,NewDevice>(
"mirror_scratch", view.layout());
109 template<
class Device,
typename T>
111 return View<T**,CLayout,Device>();
114 template<
class NewDevice,
class Device,
typename T>
116 return View<T**,CLayout,NewDevice>(
"mirror_scratch", view.layout());
121 template<
class T1,
class T2>
123 if(std::is_same<typename T1::device_type,typename T2::device_type>() && view_dest.data()==view_src.data()){
126 Kokkos::deep_copy(view_dest, view_src);
void mirror_copy(T1 &view_dest, const T2 &view_src)
Definition: my_mirror_view.hpp:122
Kokkos::LayoutRight CLayout
Definition: space_settings.hpp:67
View< T *, CLayout, Device > my_mirror_scratch_view(const View< T *, CLayout, Device, Kokkos::MemoryTraits< Kokkos::Unmanaged >> &view, Device nd)
Definition: my_mirror_view.hpp:97
View< T *, CLayout, Device > my_mirror_view(const View< T *, CLayout, Device > &view, Device nd)
Definition: my_mirror_view.hpp:14
Kokkos::ViewAllocateWithoutInitializing NoInit
Definition: space_settings.hpp:68