XGCa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
my_subview.hpp
Go to the documentation of this file.
1 #ifndef MY_SUBVIEW_HPP
2 #define MY_SUBVIEW_HPP
3 
4 #include "space_settings.hpp"
5 
6 // 3D to 1D
7 template<class Device, typename T>
8 Kokkos::View<T*,Kokkos::LayoutRight,Device> my_subview(const Kokkos::View<T***,Kokkos::LayoutRight,Device>& view, int i, int j){
9  return Kokkos::View<T*,Kokkos::LayoutRight,Device>(view, i, j, Kokkos::ALL());
10 }
11 
12 // 2D to 1D
13 template<class Device, typename T>
14 Kokkos::View<T*,Kokkos::LayoutRight,Device> my_subview(const Kokkos::View<T**,Kokkos::LayoutRight,Device>& view, int i){
15  return Kokkos::View<T*,Kokkos::LayoutRight,Device>(view, i, Kokkos::ALL());
16 }
17 
18 // 4D to 2D
19 template<class Device, typename T>
20 Kokkos::View<T**,Kokkos::LayoutRight,Device> my_subview(const Kokkos::View<T****,Kokkos::LayoutRight,Device>& view, int i, int j){
21  return Kokkos::View<T**,Kokkos::LayoutRight,Device>(view, i, j, Kokkos::ALL(), Kokkos::ALL());
22 }
23 
24 // 3D to 2D
25 template<class Device, typename T>
26 Kokkos::View<T**,Kokkos::LayoutRight,Device> my_subview(const Kokkos::View<T***,Kokkos::LayoutRight,Device>& view, int i){
27  return Kokkos::View<T**,Kokkos::LayoutRight,Device>(view, i, Kokkos::ALL(), Kokkos::ALL());
28 }
29 
30 // 4D to 3D
31 template<class Device, typename T>
32 Kokkos::View<T***,Kokkos::LayoutRight,Device> my_subview(const Kokkos::View<T****,Kokkos::LayoutRight,Device>& view, int i){
33  return Kokkos::View<T***,Kokkos::LayoutRight,Device>(view, i, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
34 }
35 
36 #endif
Kokkos::View< T *, Kokkos::LayoutRight, Device > my_subview(const Kokkos::View< T ***, Kokkos::LayoutRight, Device > &view, int i, int j)
Definition: my_subview.hpp:8