OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
t_to_memory_c.hpp
1 /*
2  * t_to_memory_c.hpp
3  *
4  * Created on: Aug 27, 2014
5  * Author: Pietro Incardona
6  */
7 
8 #ifndef T_TO_MEMORY_C_HPP_
9 #define T_TO_MEMORY_C_HPP_
10 
11 #include <boost/mpl/int.hpp>
12 #include <memory_ly/memory_c.hpp>
13 
32 #include <boost/type_traits/remove_reference.hpp>
33 #include <boost/type_traits/remove_const.hpp>
34 
35 // First thing the metafunction has to do, is to remove eventually reference and const attribute
36 
37 template<typename T>
39 {
41  typedef typename boost::remove_const <typename boost::remove_reference< T >::type >::type type;
42 };
43 
45 template<typename T>
47 {
49  typedef memory_c<T> type;
50 };
51 
53 template<typename T>
55 {
58 };
59 
60 
62 template<typename T,size_t N1>
63 struct t_to_memory_c_impl<T[N1]>
64 {
67 
69  typedef boost::mpl::vector<T,boost::mpl::int_<N1>> prim_vmpl;
70 };
71 
73 template<typename T,size_t N1>
75 {
78 
80  typedef boost::mpl::vector<T,boost::mpl::int_<N1>> prim_vmpl;
81 };
82 
84 template<typename T,size_t N1,size_t N2>
85 struct t_to_memory_c_impl<T[N1][N2]>
86 {
89  boost::mpl::int_<N2>>>> type;
90 
91 
93  typedef boost::mpl::vector<T,boost::mpl::int_<N1>,
94  boost::mpl::int_<N2>> prim_vmpl;
95 };
96 
98 template<typename T,size_t N1,size_t N2>
99 struct t_to_memory_c_red_impl<T[N1][N2]>
100 {
103  boost::mpl::int_<N2>>>,MEMORY_C_REDUCED> type;
104 
106  typedef boost::mpl::vector<T,boost::mpl::int_<N1>,
107  boost::mpl::int_<N2>> prim_vmpl;
108 };
109 
111 template<typename T,size_t N1,size_t N2,size_t N3>
112 struct t_to_memory_c_impl<T[N1][N2][N3]>
113 {
116  boost::mpl::int_<N2>,
117  boost::mpl::int_<N3>>>> type;
118 };
119 
121 template<typename T,size_t N1,size_t N2,size_t N3>
122 struct t_to_memory_c_red_impl<T[N1][N2][N3]>
123 {
126  boost::mpl::int_<N2>,
127  boost::mpl::int_<N3>>>,MEMORY_C_REDUCED> type;
128 };
129 
131 template<typename T,size_t N1,size_t N2,size_t N3,size_t N4>
132 struct t_to_memory_c_impl<T[N1][N2][N3][N4]>
133 {
136  boost::mpl::int_<N2>,
137  boost::mpl::int_<N3>,
138  boost::mpl::int_<N4>>>> type;
139 };
140 
142 template<typename T,size_t N1,size_t N2,size_t N3,size_t N4>
143 struct t_to_memory_c_red_impl<T[N1][N2][N3][N4]>
144 {
147  boost::mpl::int_<N2>,
148  boost::mpl::int_<N3>,
149  boost::mpl::int_<N4>>>,MEMORY_C_REDUCED> type;
150 };
151 
153 template<typename T,size_t N1,size_t N2,size_t N3,size_t N4,size_t N5>
154 struct t_to_memory_c_impl<T[N1][N2][N3][N4][N5]>
155 {
158  boost::mpl::int_<N2>,
159  boost::mpl::int_<N3>,
160  boost::mpl::int_<N4>,
161  boost::mpl::int_<N5>>>> type;
162 };
163 
165 template<typename T,size_t N1,size_t N2,size_t N3,size_t N4,size_t N5>
166 struct t_to_memory_c_red_impl<T[N1][N2][N3][N4][N5]>
167 {
170  boost::mpl::int_<N2>,
171  boost::mpl::int_<N3>,
172  boost::mpl::int_<N4>,
173  boost::mpl::int_<N5>>>,MEMORY_C_REDUCED> type;
174 };
175 
177 template<typename T,size_t N1,size_t N2,size_t N3,size_t N4,size_t N5, size_t N6>
178 struct t_to_memory_c_impl<T[N1][N2][N3][N4][N5][N6]>
179 {
182  boost::mpl::int_<N2>,
183  boost::mpl::int_<N3>,
184  boost::mpl::int_<N4>,
185  boost::mpl::int_<N5>,
186  boost::mpl::int_<N6>>>> type;
187 };
188 
190 template<typename T,size_t N1,size_t N2,size_t N3,size_t N4,size_t N5, size_t N6, size_t N7>
191 struct t_to_memory_c_impl<T[N1][N2][N3][N4][N5][N6][N7]>
192 {
195  boost::mpl::int_<N2>,
196  boost::mpl::int_<N3>,
197  boost::mpl::int_<N4>,
198  boost::mpl::int_<N5>,
199  boost::mpl::int_<N6>,
200  boost::mpl::int_<N7>>>> type;
201 };
202 
204 template<typename T,size_t N1,size_t N2,size_t N3,size_t N4,size_t N5, size_t N6, size_t N7, size_t N8>
205 struct t_to_memory_c_impl<T[N1][N2][N3][N4][N5][N6][N7][N8]>
206 {
209  boost::mpl::int_<N2>,
210  boost::mpl::int_<N3>,
211  boost::mpl::int_<N4>,
212  boost::mpl::int_<N5>,
213  boost::mpl::int_<N6>,
214  boost::mpl::int_<N7>,
215  boost::mpl::int_<N8>>>> type;
216 };
217 
219 template<typename T,size_t N1,size_t N2,size_t N3,size_t N4,size_t N5, size_t N6, size_t N7, size_t N8, size_t N9>
220 struct t_to_memory_c_impl<T[N1][N2][N3][N4][N5][N6][N7][N8][N9]>
221 {
224  boost::mpl::int_<N2>,
225  boost::mpl::int_<N3>,
226  boost::mpl::int_<N4>,
227  boost::mpl::int_<N5>,
228  boost::mpl::int_<N6>,
229  boost::mpl::int_<N7>,
230  boost::mpl::int_<N8>,
231  boost::mpl::int_<N9>>>> type;
232 };
233 
235 template<typename T,size_t N1,size_t N2,size_t N3,size_t N4,size_t N5, size_t N6, size_t N7, size_t N8, size_t N9, size_t N10>
236 struct t_to_memory_c_impl<T[N1][N2][N3][N4][N5][N6][N7][N8][N9][N10]>
237 {
240  boost::mpl::int_<N2>,
241  boost::mpl::int_<N3>,
242  boost::mpl::int_<N4>,
243  boost::mpl::int_<N5>,
244  boost::mpl::int_<N6>,
245  boost::mpl::int_<N7>,
246  boost::mpl::int_<N8>,
247  boost::mpl::int_<N9>,
248  boost::mpl::int_<N10>>>> type;
249 };
250 
259 template<typename T>
261 {
263 };
264 
273 template<typename T>
275 {
277 };
278 
279 #endif /* T_TO_MEMORY_C_HPP_ */
memory_c< multi_array< boost::mpl::vector< T, boost::mpl::int_< N1 >, boost::mpl::int_< N2 >, boost::mpl::int_< N3 > > > > type
tranform a type T into a memory_c<multi_array<.......>>
memory_c< multi_array< boost::mpl::vector< T, boost::mpl::int_< N1 > > >, MEMORY_C_REDUCED > type
transform a type T into memory_c<T,MEMORY_C_REDUCED>
t_to_memory_c is a metafunction that given T it convert it into
Meta-function t_to_memory_c.
memory_c< multi_array< boost::mpl::vector< T, boost::mpl::int_< N1 >, boost::mpl::int_< N2 >, boost::mpl::int_< N3 >, boost::mpl::int_< N4 >, boost::mpl::int_< N5 > > > > type
tranform a type T into a memory_c<multi_array<.......>>
memory_c< multi_array< boost::mpl::vector< T, boost::mpl::int_< N1 >, boost::mpl::int_< N2 > > > > type
tranform a type T into a memory_c<multi_array<.......>>
memory_c< multi_array< boost::mpl::vector< T, boost::mpl::int_< N1 >, boost::mpl::int_< N2 >, boost::mpl::int_< N3 >, boost::mpl::int_< N4 >, boost::mpl::int_< N5 >, boost::mpl::int_< N6 >, boost::mpl::int_< N7 >, boost::mpl::int_< N8 > > > > type
tranform a type T into a memory_c<multi_array<.......>>
boost::mpl::vector< T, boost::mpl::int_< N1 >, boost::mpl::int_< N2 > > prim_vmpl
the internal array primitive information represented into a boost mpl vector
Partial specialization for scalar N=0.
memory_c< multi_array< boost::mpl::vector< T, boost::mpl::int_< N1 >, boost::mpl::int_< N2 >, boost::mpl::int_< N3 >, boost::mpl::int_< N4 >, boost::mpl::int_< N5 >, boost::mpl::int_< N6 >, boost::mpl::int_< N7 >, boost::mpl::int_< N8 >, boost::mpl::int_< N9 >, boost::mpl::int_< N10 > > > > type
tranform a type T into a memory_c<multi_array<.......>>
memory_c< multi_array< boost::mpl::vector< T, boost::mpl::int_< N1 >, boost::mpl::int_< N2 >, boost::mpl::int_< N3 >, boost::mpl::int_< N4 >, boost::mpl::int_< N5 >, boost::mpl::int_< N6 >, boost::mpl::int_< N7 >, boost::mpl::int_< N8 >, boost::mpl::int_< N9 > > > > type
tranform a type T into a memory_c<multi_array<.......>>
memory_c< multi_array< boost::mpl::vector< T, boost::mpl::int_< N1 > > > > type
transfrom a type T into memory_c<T>
memory_c< multi_array< boost::mpl::vector< T, boost::mpl::int_< N1 >, boost::mpl::int_< N2 >, boost::mpl::int_< N3 >, boost::mpl::int_< N4 >, boost::mpl::int_< N5 >, boost::mpl::int_< N6 > > > > type
tranform a type T into a memory_c<multi_array<.......>>
boost::mpl::vector< T, boost::mpl::int_< N1 >, boost::mpl::int_< N2 > > prim_vmpl
the internal array primitive information represented into a boost mpl vector
memory_c< multi_array< boost::mpl::vector< T, boost::mpl::int_< N1 >, boost::mpl::int_< N2 >, boost::mpl::int_< N3 > > >, MEMORY_C_REDUCED > type
tranform a type T into a memory_c<multi_array<.......>>
memory_c< T > type
transform a type T into memory_c<T>
memory_c< multi_array< boost::mpl::vector< T, boost::mpl::int_< N1 >, boost::mpl::int_< N2 >, boost::mpl::int_< N3 >, boost::mpl::int_< N4 > > >, MEMORY_C_REDUCED > type
tranform a type T into a memory_c<multi_array<.......>,MEMORY_C_REDUCED>
boost::mpl::vector< T, boost::mpl::int_< N1 > > prim_vmpl
the internal array primitive information represented into a boost mpl vector
memory_c< multi_array< boost::mpl::vector< T, boost::mpl::int_< N1 >, boost::mpl::int_< N2 >, boost::mpl::int_< N3 >, boost::mpl::int_< N4 >, boost::mpl::int_< N5 >, boost::mpl::int_< N6 >, boost::mpl::int_< N7 > > > > type
tranform a type T into a memory_c<multi_array<.......>>
memory_c< multi_array< boost::mpl::vector< T, boost::mpl::int_< N1 >, boost::mpl::int_< N2 >, boost::mpl::int_< N3 >, boost::mpl::int_< N4 >, boost::mpl::int_< N5 > > >, MEMORY_C_REDUCED > type
tranform a type T into a memory_c<multi_array<.......>,MEMORY_C_REDUCED>
boost::remove_const< typename boost::remove_reference< T >::type >::type type
remove all attributes const and reference from the type
Partial specialization for scalar N=0.
memory_c< multi_array< boost::mpl::vector< T, boost::mpl::int_< N1 >, boost::mpl::int_< N2 > > >, MEMORY_C_REDUCED > type
transform a type T into a memory_c<multi_array<.......>,MEMORY_C_REDUCED>
memory_c< multi_array< boost::mpl::vector< T, boost::mpl::int_< N1 >, boost::mpl::int_< N2 >, boost::mpl::int_< N3 >, boost::mpl::int_< N4 > > > > type
tranform a type T into a memory_c<multi_array<.......>>
Meta-function t_to_memory_c_red.
memory_c< T, MEMORY_C_REDUCED > type
transform a type T into memory_c<T,MEMORY_C_REDUCED>
boost::mpl::vector< T, boost::mpl::int_< N1 > > prim_vmpl
the internal array primitive information represented into a boost mpl vector