10 #ifndef KOKKOS_VIEW_UTILS_HPP
11 #define KOKKOS_VIEW_UTILS_HPP
17 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
18 #define KOKKOS_IMPL_PUBLIC_INCLUDE
19 #define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE
21 #include "Kokkos_View.hpp"
22 #ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE
23 #undef KOKKOS_IMPL_PUBLIC_INCLUDE
24 #undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE
31 KOKKOS_INLINE_FUNCTION
34 KOKKOS_IF_ON_HOST(
throw std::runtime_error(msg);)
36 KOKKOS_IF_ON_DEVICE(Kokkos::abort(msg);)
41 template<
class T ,
class Device >
47 template<
class T ,
class Device >
53 template<
class T ,
unsigned N ,
class Device >
62 KOKKOS_INLINE_FUNCTION
63 static size_t eval(
const size_t n0 ,
70 const size_t n7 = 0 ) {
74 template <
typename Layout>
75 KOKKOS_INLINE_FUNCTION
76 static size_t eval(
const Layout& layout ) {
77 return layout.dimension[0];
81 KOKKOS_INLINE_FUNCTION
82 static size_t eval(
const size_t n0 ,
89 const size_t n7 = 0 ) {
93 template <
typename Layout>
94 KOKKOS_INLINE_FUNCTION
95 static size_t eval(
const Layout& layout ) {
96 return layout.dimension[1];
100 KOKKOS_INLINE_FUNCTION
101 static size_t eval(
const size_t n0 ,
104 const size_t n3 = 0 ,
105 const size_t n4 = 0 ,
106 const size_t n5 = 0 ,
107 const size_t n6 = 0 ,
108 const size_t n7 = 0 ) {
112 template <
typename Layout>
113 KOKKOS_INLINE_FUNCTION
114 static size_t eval(
const Layout& layout ) {
115 return layout.dimension[2];
119 KOKKOS_INLINE_FUNCTION
120 static size_t eval(
const size_t n0 ,
124 const size_t n4 = 0 ,
125 const size_t n5 = 0 ,
126 const size_t n6 = 0 ,
127 const size_t n7 = 0 ) {
131 template <
typename Layout>
132 KOKKOS_INLINE_FUNCTION
133 static size_t eval(
const Layout& layout ) {
134 return layout.dimension[3];
138 KOKKOS_INLINE_FUNCTION
139 static size_t eval(
const size_t n0 ,
144 const size_t n5 = 0 ,
145 const size_t n6 = 0 ,
146 const size_t n7 = 0 ) {
150 template <
typename Layout>
151 KOKKOS_INLINE_FUNCTION
152 static size_t eval(
const Layout& layout ) {
153 return layout.dimension[4];
157 KOKKOS_INLINE_FUNCTION
158 static size_t eval(
const size_t n0 ,
164 const size_t n6 = 0 ,
165 const size_t n7 = 0 ) {
169 template <
typename Layout>
170 KOKKOS_INLINE_FUNCTION
171 static size_t eval(
const Layout& layout ) {
172 return layout.dimension[5];
176 KOKKOS_INLINE_FUNCTION
177 static size_t eval(
const size_t n0 ,
184 const size_t n7 = 0 ) {
188 template <
typename Layout>
189 KOKKOS_INLINE_FUNCTION
190 static size_t eval(
const Layout& layout ) {
191 return layout.dimension[6];
195 KOKKOS_INLINE_FUNCTION
196 static size_t eval(
const size_t n0 ,
207 template <
typename Layout>
208 KOKKOS_INLINE_FUNCTION
209 static size_t eval(
const Layout& layout ) {
210 return layout.dimension[7];
217 template <
typename view_type,
typename Enabled =
void>
223 template <
typename view_type,
typename Enabled =
void>
225 typedef typename view_type::array_type::non_const_value_type
type;
228 template <
typename ViewType>
231 size_t N0 = 0,
size_t N1 = 0,
size_t N2 = 0,
size_t N3 = 0,
232 size_t N4 = 0,
size_t N5 = 0,
size_t N6 = 0,
size_t N7 = 0)
234 return ViewType(label, N0, N1, N2, N3, N4, N5, N6, N7);
237 template <
typename ViewType>
240 size_t N0 = 0,
size_t N1 = 0,
size_t N2 = 0,
size_t N3 = 0,
241 size_t N4 = 0,
size_t N5 = 0,
size_t N6 = 0,
size_t N7 = 0)
243 return ViewType(init, N0, N1, N2, N3, N4, N5, N6, N7);
246 template <
typename ViewType>
249 size_t N0 = 0,
size_t N1 = 0,
size_t N2 = 0,
size_t N3 = 0,
250 size_t N4 = 0,
size_t N5 = 0,
size_t N6 = 0,
size_t N7 = 0)
252 return ViewType(ptr, N0, N1, N2, N3, N4, N5, N6, N7);
255 template <
typename ViewType>
258 const Impl::WithoutInitializing_t& init,
259 size_t N0 = 0,
size_t N1 = 0,
size_t N2 = 0,
size_t N3 = 0,
260 size_t N4 = 0,
size_t N5 = 0,
size_t N6 = 0,
size_t N7 = 0)
262 return ViewType(view_alloc(label,init),
263 N0, N1, N2, N3, N4, N5, N6, N7);
270 template <
class OutputView,
typename Enabled =
void>
277 #endif // KOKKOS_VIEW_UTILS_HPP
static KOKKOS_INLINE_FUNCTION size_t eval(const size_t n0, const size_t n1, const size_t n2, const size_t n3, const size_t n4, const size_t n5, const size_t n6, const size_t n7)
static KOKKOS_INLINE_FUNCTION size_t eval(const size_t n0, const size_t n1, const size_t n2, const size_t n3=0, const size_t n4=0, const size_t n5=0, const size_t n6=0, const size_t n7=0)
static KOKKOS_INLINE_FUNCTION size_t eval(const size_t n0, const size_t n1, const size_t n2, const size_t n3, const size_t n4, const size_t n5, const size_t n6, const size_t n7=0)
RebindStokhosStorageDevice< T, Device >::type * type
static KOKKOS_INLINE_FUNCTION size_t eval(const size_t n0, const size_t n1, const size_t n2, const size_t n3, const size_t n4, const size_t n5=0, const size_t n6=0, const size_t n7=0)
static KOKKOS_INLINE_FUNCTION size_t eval(const size_t n0, const size_t n1=0, const size_t n2=0, const size_t n3=0, const size_t n4=0, const size_t n5=0, const size_t n6=0, const size_t n7=0)
static KOKKOS_INLINE_FUNCTION size_t eval(const Layout &layout)
KOKKOS_INLINE_FUNCTION void raise_error(const char *msg)
static KOKKOS_INLINE_FUNCTION size_t eval(const size_t n0, const size_t n1, const size_t n2, const size_t n3, const size_t n4, const size_t n5, const size_t n6=0, const size_t n7=0)
static KOKKOS_INLINE_FUNCTION size_t eval(const Layout &layout)
static KOKKOS_INLINE_FUNCTION size_t eval(const Layout &layout)
ViewType make_view(const std::string &label, size_t N0=0, size_t N1=0, size_t N2=0, size_t N3=0, size_t N4=0, size_t N5=0, size_t N6=0, size_t N7=0)
static KOKKOS_INLINE_FUNCTION size_t eval(const size_t n0, const size_t n1, const size_t n2, const size_t n3, const size_t n4=0, const size_t n5=0, const size_t n6=0, const size_t n7=0)
static KOKKOS_INLINE_FUNCTION size_t eval(const Layout &layout)
view_type::array_type::non_const_value_type type
static KOKKOS_INLINE_FUNCTION size_t eval(const size_t n0, const size_t n1, const size_t n2=0, const size_t n3=0, const size_t n4=0, const size_t n5=0, const size_t n6=0, const size_t n7=0)
RebindStokhosStorageDevice< T, Device >::type * type
static KOKKOS_INLINE_FUNCTION size_t eval(const Layout &layout)
static KOKKOS_INLINE_FUNCTION size_t eval(const Layout &layout)
static KOKKOS_INLINE_FUNCTION size_t eval(const Layout &layout)
static KOKKOS_INLINE_FUNCTION size_t eval(const Layout &layout)