42 #ifndef KOKKOS_VIEW_UTILS_HPP
43 #define KOKKOS_VIEW_UTILS_HPP
47 #include "Kokkos_View.hpp"
53 KOKKOS_INLINE_FUNCTION
56 #if defined(__CUDACC__) && defined(__CUDA_ARCH__)
59 throw std::runtime_error(msg);
65 template<
class T ,
class Device >
71 template<
class T ,
class Device >
77 template<
class T ,
unsigned N ,
class Device >
86 KOKKOS_INLINE_FUNCTION
87 static size_t eval(
const size_t n0 ,
94 const size_t n7 = 0 ) {
98 template <
typename Layout>
99 KOKKOS_INLINE_FUNCTION
100 static size_t eval(
const Layout& layout ) {
101 return layout.dimension[0];
105 KOKKOS_INLINE_FUNCTION
106 static size_t eval(
const size_t n0 ,
108 const size_t n2 = 0 ,
109 const size_t n3 = 0 ,
110 const size_t n4 = 0 ,
111 const size_t n5 = 0 ,
112 const size_t n6 = 0 ,
113 const size_t n7 = 0 ) {
117 template <
typename Layout>
118 KOKKOS_INLINE_FUNCTION
119 static size_t eval(
const Layout& layout ) {
120 return layout.dimension[1];
124 KOKKOS_INLINE_FUNCTION
125 static size_t eval(
const size_t n0 ,
128 const size_t n3 = 0 ,
129 const size_t n4 = 0 ,
130 const size_t n5 = 0 ,
131 const size_t n6 = 0 ,
132 const size_t n7 = 0 ) {
136 template <
typename Layout>
137 KOKKOS_INLINE_FUNCTION
138 static size_t eval(
const Layout& layout ) {
139 return layout.dimension[2];
143 KOKKOS_INLINE_FUNCTION
144 static size_t eval(
const size_t n0 ,
148 const size_t n4 = 0 ,
149 const size_t n5 = 0 ,
150 const size_t n6 = 0 ,
151 const size_t n7 = 0 ) {
155 template <
typename Layout>
156 KOKKOS_INLINE_FUNCTION
157 static size_t eval(
const Layout& layout ) {
158 return layout.dimension[3];
162 KOKKOS_INLINE_FUNCTION
163 static size_t eval(
const size_t n0 ,
168 const size_t n5 = 0 ,
169 const size_t n6 = 0 ,
170 const size_t n7 = 0 ) {
174 template <
typename Layout>
175 KOKKOS_INLINE_FUNCTION
176 static size_t eval(
const Layout& layout ) {
177 return layout.dimension[4];
181 KOKKOS_INLINE_FUNCTION
182 static size_t eval(
const size_t n0 ,
188 const size_t n6 = 0 ,
189 const size_t n7 = 0 ) {
193 template <
typename Layout>
194 KOKKOS_INLINE_FUNCTION
195 static size_t eval(
const Layout& layout ) {
196 return layout.dimension[5];
200 KOKKOS_INLINE_FUNCTION
201 static size_t eval(
const size_t n0 ,
208 const size_t n7 = 0 ) {
212 template <
typename Layout>
213 KOKKOS_INLINE_FUNCTION
214 static size_t eval(
const Layout& layout ) {
215 return layout.dimension[6];
219 KOKKOS_INLINE_FUNCTION
220 static size_t eval(
const size_t n0 ,
231 template <
typename Layout>
232 KOKKOS_INLINE_FUNCTION
233 static size_t eval(
const Layout& layout ) {
234 return layout.dimension[7];
241 template <
typename view_type,
typename Enabled =
void>
247 template <
typename view_type,
typename Enabled =
void>
249 typedef typename view_type::array_type::non_const_value_type
type;
252 template <
typename ViewType>
255 size_t N0 = 0,
size_t N1 = 0,
size_t N2 = 0,
size_t N3 = 0,
256 size_t N4 = 0,
size_t N5 = 0,
size_t N6 = 0,
size_t N7 = 0)
258 return ViewType(label, N0, N1, N2, N3, N4, N5, N6, N7);
261 template <
typename ViewType>
264 size_t N0 = 0,
size_t N1 = 0,
size_t N2 = 0,
size_t N3 = 0,
265 size_t N4 = 0,
size_t N5 = 0,
size_t N6 = 0,
size_t N7 = 0)
267 return ViewType(init, N0, N1, N2, N3, N4, N5, N6, N7);
270 template <
typename ViewType>
273 size_t N0 = 0,
size_t N1 = 0,
size_t N2 = 0,
size_t N3 = 0,
274 size_t N4 = 0,
size_t N5 = 0,
size_t N6 = 0,
size_t N7 = 0)
276 return ViewType(ptr, N0, N1, N2, N3, N4, N5, N6, N7);
279 template <
typename ViewType>
282 const Impl::WithoutInitializing_t& init,
283 size_t N0 = 0,
size_t N1 = 0,
size_t N2 = 0,
size_t N3 = 0,
284 size_t N4 = 0,
size_t N5 = 0,
size_t N6 = 0,
size_t N7 = 0)
286 return ViewType(view_alloc(label,init),
287 N0, N1, N2, N3, N4, N5, N6, N7);
294 template <
class OutputView,
typename Enabled =
void>
301 #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)