Debian Codegraph @

packages/stokhos/src/sacado/kokkos/Kokkos_AnalyzeStokhosShape.hpp

raw
1 // @HEADER
2 // *****************************************************************************
3 // Stokhos Package
4 //
5 // Copyright 2009 NTESS and the Stokhos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9
10 #if false
11 #ifndef KOKKOS_ANALYZE_STOKHOS_SHAPE_HPP
12 #define KOKKOS_ANALYZE_STOKHOS_SHAPE_HPP
13
14 //#include <impl/Kokkos_Shape.hpp>
15
16 //----------------------------------------------------------------------------
17 //----------------------------------------------------------------------------
18
19 namespace Kokkos {
20 namespace Impl {
21
22 //----------------------------------------------------------------------------
23
24 /** \brief Analyze the array shape defined by a Kokkos::View data type.
25 *
26 * It is presumed that the data type can be mapped down to a multidimensional
27 * array of an intrinsic scalar numerical type (double, float, int, ... ).
28 * The 'value_type' of an array may be an embedded aggregate type such
29 * as a fixed length array 'Array<T,N>'. In this case the 'array_instrinsic_type'
30 * represents the underlying array of intrinsic numeric type.
31 *
32 * The embedded aggregate type must have an AnalyzeStokhosShape specialization
33 * to map it down to a shape and intrinsic scalar numerical type.
34 *
35 * This is a slight variation of the original AnalyzeShape in that takes the
36 * the Layout as a template parameter. This allows the sacado specializations
37 * to put the sacado dimension in different places depending on the layout.
38 */
39
40 template< class T, class Layout >
41 struct AnalyzeStokhosShape : public Shape< sizeof(T) , 0 >
42 {
43 typedef void specialize ;
44
45 typedef Shape< sizeof(T), 0 > shape ;
46
47 typedef T array_intrinsic_type ;
48 typedef T flat_array_type ;
49 typedef T value_type ;
50 typedef T type ;
51 typedef const T const_array_intrinsic_type ;
52 typedef const T const_flat_array_type ;
53 typedef const T const_value_type ;
54 typedef const T const_type ;
55 typedef T non_const_array_intrinsic_type ;
56 typedef T non_const_flat_array_type ;
57 typedef T non_const_value_type ;
58 typedef T non_const_type ;
59 };
60
61 template< class Layout>
62 struct AnalyzeStokhosShape<void, Layout> : public Shape< 0 , 0 >
63 {
64 typedef void specialize ;
65
66 typedef Shape< 0 , 0 > shape ;
67
68 typedef void array_intrinsic_type ;
69 typedef void flat_array_type ;
70 typedef void value_type ;
71 typedef void type ;
72 typedef const void const_array_intrinsic_type ;
73 typedef const void const_flat_array_type ;
74 typedef const void const_value_type ;
75 typedef const void const_type ;
76 typedef void non_const_array_intrinsic_type ;
77 typedef void non_const_flat_array_type ;
78 typedef void non_const_value_type ;
79 typedef void non_const_type ;
80 };
81
82 template< class T, class Layout >
83 struct AnalyzeStokhosShape< const T, Layout > :
84 public AnalyzeStokhosShape<T, Layout>::shape
85 {
86 private:
87 typedef AnalyzeStokhosShape<T, Layout> nested ;
88 public:
89
90 typedef typename nested::specialize specialize ;
91
92 typedef typename nested::shape shape ;
93
94 typedef typename nested::const_array_intrinsic_type array_intrinsic_type ;
95 typedef typename nested::const_flat_array_type flat_array_type ;
96 typedef typename nested::const_value_type value_type ;
97 typedef typename nested::const_type type ;
98
99 typedef typename nested::const_array_intrinsic_type const_array_intrinsic_type ;
100 typedef typename nested::const_flat_array_type const_flat_array_type ;
101 typedef typename nested::const_value_type const_value_type ;
102 typedef typename nested::const_type const_type ;
103
104 typedef typename nested::non_const_array_intrinsic_type non_const_array_intrinsic_type ;
105 typedef typename nested::non_const_flat_array_type non_const_flat_array_type ;
106 typedef typename nested::non_const_value_type non_const_value_type ;
107 typedef typename nested::non_const_type non_const_type ;
108 };
109
110 template< class T, class Layout >
111 struct AnalyzeStokhosShape< T *, Layout >
112 : public ShapeInsert< typename AnalyzeStokhosShape<T,Layout>::shape , 0 >::type
113 {
114 private:
115 typedef AnalyzeStokhosShape<T, Layout> nested ;
116 public:
117
118 typedef typename nested::specialize specialize ;
119
120 typedef typename ShapeInsert< typename nested::shape , 0 >::type shape ;
121
122 typedef typename nested::array_intrinsic_type * array_intrinsic_type ;
123 typedef typename nested::flat_array_type * flat_array_type ;
124 typedef typename nested::value_type value_type ;
125 typedef typename nested::type * type ;
126
127 typedef typename nested::const_array_intrinsic_type * const_array_intrinsic_type ;
128 typedef typename nested::const_flat_array_type * const_flat_array_type ;
129 typedef typename nested::const_value_type const_value_type ;
130 typedef typename nested::const_type * const_type ;
131
132 typedef typename nested::non_const_array_intrinsic_type * non_const_array_intrinsic_type ;
133 typedef typename nested::non_const_flat_array_type * non_const_flat_array_type ;
134 typedef typename nested::non_const_value_type non_const_value_type ;
135 typedef typename nested::non_const_type * non_const_type ;
136 };
137
138 template< class T, class Layout >
139 struct AnalyzeStokhosShape< T[], Layout >
140 : public ShapeInsert< typename AnalyzeStokhosShape<T, Layout>::shape , 0 >::type
141 {
142 private:
143 typedef AnalyzeStokhosShape<T, Layout> nested ;
144 public:
145
146 typedef typename nested::specialize specialize ;
147
148 typedef typename ShapeInsert< typename nested::shape , 0 >::type shape ;
149
150 typedef typename nested::array_intrinsic_type array_intrinsic_type [] ;
151 typedef typename nested::flat_array_type flat_array_type [] ;
152 typedef typename nested::value_type value_type ;
153 typedef typename nested::type type [] ;
154
155 typedef typename nested::const_array_intrinsic_type const_array_intrinsic_type [] ;
156 typedef typename nested::const_flat_array_type const_flat_array_type [] ;
157 typedef typename nested::const_value_type const_value_type ;
158 typedef typename nested::const_type const_type [] ;
159
160 typedef typename nested::non_const_array_intrinsic_type non_const_array_intrinsic_type [] ;
161 typedef typename nested::non_const_flat_array_type non_const_flat_array_type [] ;
162 typedef typename nested::non_const_value_type non_const_value_type ;
163 typedef typename nested::non_const_type non_const_type [] ;
164 };
165
166 template< class T, class Layout >
167 struct AnalyzeStokhosShape< const T[], Layout >
168 : public ShapeInsert< typename AnalyzeStokhosShape< const T, Layout >::shape , 0 >::type
169 {
170 private:
171 typedef AnalyzeStokhosShape< const T, Layout > nested ;
172 public:
173
174 typedef typename nested::specialize specialize ;
175
176 typedef typename ShapeInsert< typename nested::shape , 0 >::type shape ;
177
178 typedef typename nested::array_intrinsic_type array_intrinsic_type [] ;
179 typedef typename nested::flat_array_type flat_array_type [] ;
180 typedef typename nested::value_type value_type ;
181 typedef typename nested::type type [] ;
182
183 typedef typename nested::const_array_intrinsic_type const_array_intrinsic_type [] ;
184 typedef typename nested::const_flat_array_type const_flat_array_type [] ;
185 typedef typename nested::const_value_type const_value_type ;
186 typedef typename nested::const_type const_type [] ;
187
188 typedef typename nested::non_const_array_intrinsic_type non_const_array_intrinsic_type [] ;
189 typedef typename nested::non_const_flat_array_type non_const_flat_array_type [] ;
190 typedef typename nested::non_const_value_type non_const_value_type ;
191 typedef typename nested::non_const_type non_const_type [] ;
192 };
193
194 template< class T, class Layout , unsigned N >
195 struct AnalyzeStokhosShape< T[N], Layout >
196 : public ShapeInsert< typename AnalyzeStokhosShape<T, Layout>::shape , N >::type
197 {
198 private:
199 typedef AnalyzeStokhosShape<T, Layout> nested ;
200 public:
201
202 typedef typename nested::specialize specialize ;
203
204 typedef typename ShapeInsert< typename nested::shape , N >::type shape ;
205
206 typedef typename nested::array_intrinsic_type array_intrinsic_type [N] ;
207 typedef typename nested::flat_array_type flat_array_type [N] ;
208 typedef typename nested::value_type value_type ;
209 typedef typename nested::type type [N] ;
210
211 typedef typename nested::const_array_intrinsic_type const_array_intrinsic_type [N] ;
212 typedef typename nested::const_flat_array_type const_flat_array_type [N] ;
213 typedef typename nested::const_value_type const_value_type ;
214 typedef typename nested::const_type const_type [N] ;
215
216 typedef typename nested::non_const_array_intrinsic_type non_const_array_intrinsic_type [N] ;
217 typedef typename nested::non_const_flat_array_type non_const_flat_array_type [N] ;
218 typedef typename nested::non_const_value_type non_const_value_type ;
219 typedef typename nested::non_const_type non_const_type [N] ;
220 };
221
222 template< class T, class Layout , unsigned N >
223 struct AnalyzeStokhosShape< const T[N], Layout >
224 : public ShapeInsert< typename AnalyzeStokhosShape< const T, Layout >::shape , N >::type
225 {
226 private:
227 typedef AnalyzeStokhosShape< const T, Layout > nested ;
228 public:
229
230 typedef typename nested::specialize specialize ;
231
232 typedef typename ShapeInsert< typename nested::shape , N >::type shape ;
233
234 typedef typename nested::array_intrinsic_type array_intrinsic_type [N] ;
235 typedef typename nested::flat_array_type flat_array_type [N] ;
236 typedef typename nested::value_type value_type ;
237 typedef typename nested::type type [N] ;
238
239 typedef typename nested::const_array_intrinsic_type const_array_intrinsic_type [N] ;
240 typedef typename nested::const_flat_array_type const_flat_array_type [N] ;
241 typedef typename nested::const_value_type const_value_type ;
242 typedef typename nested::const_type const_type [N] ;
243
244 typedef typename nested::non_const_array_intrinsic_type non_const_array_intrinsic_type [N] ;
245 typedef typename nested::non_const_flat_array_type non_const_flat_array_type [N] ;
246 typedef typename nested::non_const_value_type non_const_value_type ;
247 typedef typename nested::non_const_type non_const_type [N] ;
248 };
249
250 } // namespace Impl
251 } // namespace Kokkos
252 #endif
253 #endif /* #ifndef KOKKOS_ANALYZE_STOKHOS_SHAPE_HPP */