42#ifndef KOKKOS_VIEW_UTILS_HPP
43#define KOKKOS_VIEW_UTILS_HPP
49#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
50#define KOKKOS_IMPL_PUBLIC_INCLUDE
51#define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE
53#include "Kokkos_View.hpp"
54#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE
55#undef KOKKOS_IMPL_PUBLIC_INCLUDE
56#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE
66 KOKKOS_IF_ON_HOST(
throw std::runtime_error(msg);)
68 KOKKOS_IF_ON_DEVICE(Kokkos::abort(msg);)
73template<
class T ,
class Device >
79template<
class T ,
class Device >
85template<
class T ,
unsigned N ,
class Device >
94 KOKKOS_INLINE_FUNCTION
95 static size_t eval(
const size_t n0 ,
100 const size_t n5 = 0 ,
101 const size_t n6 = 0 ,
102 const size_t n7 = 0 ) {
106 template <
typename Layout>
107 KOKKOS_INLINE_FUNCTION
108 static size_t eval(
const Layout& layout ) {
109 return layout.dimension[0];
113 KOKKOS_INLINE_FUNCTION
114 static size_t eval(
const size_t n0 ,
116 const size_t n2 = 0 ,
117 const size_t n3 = 0 ,
118 const size_t n4 = 0 ,
119 const size_t n5 = 0 ,
120 const size_t n6 = 0 ,
121 const size_t n7 = 0 ) {
125 template <
typename Layout>
126 KOKKOS_INLINE_FUNCTION
127 static size_t eval(
const Layout& layout ) {
128 return layout.dimension[1];
132 KOKKOS_INLINE_FUNCTION
133 static size_t eval(
const size_t n0 ,
136 const size_t n3 = 0 ,
137 const size_t n4 = 0 ,
138 const size_t n5 = 0 ,
139 const size_t n6 = 0 ,
140 const size_t n7 = 0 ) {
144 template <
typename Layout>
145 KOKKOS_INLINE_FUNCTION
146 static size_t eval(
const Layout& layout ) {
147 return layout.dimension[2];
151 KOKKOS_INLINE_FUNCTION
152 static size_t eval(
const size_t n0 ,
156 const size_t n4 = 0 ,
157 const size_t n5 = 0 ,
158 const size_t n6 = 0 ,
159 const size_t n7 = 0 ) {
163 template <
typename Layout>
164 KOKKOS_INLINE_FUNCTION
165 static size_t eval(
const Layout& layout ) {
166 return layout.dimension[3];
170 KOKKOS_INLINE_FUNCTION
171 static size_t eval(
const size_t n0 ,
176 const size_t n5 = 0 ,
177 const size_t n6 = 0 ,
178 const size_t n7 = 0 ) {
182 template <
typename Layout>
183 KOKKOS_INLINE_FUNCTION
184 static size_t eval(
const Layout& layout ) {
185 return layout.dimension[4];
189 KOKKOS_INLINE_FUNCTION
190 static size_t eval(
const size_t n0 ,
196 const size_t n6 = 0 ,
197 const size_t n7 = 0 ) {
201 template <
typename Layout>
202 KOKKOS_INLINE_FUNCTION
203 static size_t eval(
const Layout& layout ) {
204 return layout.dimension[5];
208 KOKKOS_INLINE_FUNCTION
209 static size_t eval(
const size_t n0 ,
216 const size_t n7 = 0 ) {
220 template <
typename Layout>
221 KOKKOS_INLINE_FUNCTION
222 static size_t eval(
const Layout& layout ) {
223 return layout.dimension[6];
227 KOKKOS_INLINE_FUNCTION
228 static size_t eval(
const size_t n0 ,
239 template <
typename Layout>
240 KOKKOS_INLINE_FUNCTION
241 static size_t eval(
const Layout& layout ) {
242 return layout.dimension[7];
249template <
typename view_type,
typename Enabled =
void>
255template <
typename view_type,
typename Enabled =
void>
257 typedef typename view_type::array_type::non_const_value_type
type;
260template <
typename ViewType>
263 size_t N0 = 0,
size_t N1 = 0,
size_t N2 = 0,
size_t N3 = 0,
264 size_t N4 = 0,
size_t N5 = 0,
size_t N6 = 0,
size_t N7 = 0)
266 return ViewType(label, N0, N1, N2, N3, N4, N5, N6, N7);
269template <
typename ViewType>
272 size_t N0 = 0,
size_t N1 = 0,
size_t N2 = 0,
size_t N3 = 0,
273 size_t N4 = 0,
size_t N5 = 0,
size_t N6 = 0,
size_t N7 = 0)
275 return ViewType(init, N0, N1, N2, N3, N4, N5, N6, N7);
278template <
typename ViewType>
281 size_t N0 = 0,
size_t N1 = 0,
size_t N2 = 0,
size_t N3 = 0,
282 size_t N4 = 0,
size_t N5 = 0,
size_t N6 = 0,
size_t N7 = 0)
284 return ViewType(ptr, N0, N1, N2, N3, N4, N5, N6, N7);
287template <
typename ViewType>
290 const Impl::WithoutInitializing_t& init,
291 size_t N0 = 0,
size_t N1 = 0,
size_t N2 = 0,
size_t N3 = 0,
292 size_t N4 = 0,
size_t N5 = 0,
size_t N6 = 0,
size_t N7 = 0)
294 return ViewType(view_alloc(label,init),
295 N0, N1, N2, N3, N4, N5, N6, N7);
302template <
class OutputView,
typename Enabled =
void>
303struct StokhosViewFill;
KOKKOS_INLINE_FUNCTION void raise_error(const char *msg)
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 Layout &layout)
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)
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)
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 Layout &layout)
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)
static KOKKOS_INLINE_FUNCTION size_t eval(const Layout &layout)
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, 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)
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)
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 Layout &layout)
RebindStokhosStorageDevice< T, Device >::type * type
RebindStokhosStorageDevice< T, Device >::type * type
view_type::array_type::non_const_value_type type