OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
vector_dist_operator_assign.hpp
1/*
2 * vector_dist_operator_assign.ipp
3 *
4 * Created on: Jul 21, 2016
5 * Author: i-bird
6 */
7
8#ifndef OPENFPM_NUMERICS_SRC_OPERATORS_VECTOR_VECTOR_DIST_OPERATOR_ASSIGN_HPP_
9#define OPENFPM_NUMERICS_SRC_OPERATORS_VECTOR_VECTOR_DIST_OPERATOR_ASSIGN_HPP_
10
13template<typename T>
15{
17 static inline const T & construct(const T & e)
18 {
19 return e;
20 }
21};
22
24template<>
26{
29 {
31 }
32};
33
35template<>
37{
39 static inline vector_dist_expression<0,float> construct(const float e)
40 {
42 }
43};
44
45template<typename prp1, typename expr1, typename prp2, typename expr2> void assign(prp1 & p1, const expr1 & v_e1, prp2 & p2, const expr2 & v_e2)
46{
49
50 v_exp1.init();
51 v_exp2.init();
52
53 auto it = p1.getVector().getDomainIterator();
54
55 while (it.isNext())
56 {
57 auto key = it.get();
58
59 pos_or_propL<typename prp1::vtype,prp1::prop>::value(p1.getVector(),key) = v_exp1.value(key);
60 pos_or_propL<typename prp2::vtype,prp2::prop>::value(p2.getVector(),key) = v_exp2.value(key);
61
62 ++it;
63 }
64}
65
66template<typename prp1, typename expr1, typename prp2, typename expr2, typename prp3, typename expr3> void assign(prp1 & p1, const expr1 & v_e1, prp2 & p2, const expr2 & v_e2, prp3 & p3, const expr3 & v_e3)
67{
71
72 v_exp1.init();
73 v_exp2.init();
74 v_exp3.init();
75
76 auto it = p1.getVector().getDomainIterator();
77
78 while (it.isNext())
79 {
80 auto key = it.get();
81
82 pos_or_propL<typename prp1::vtype,prp1::prop>::value(p1.getVector(),key) = v_exp1.value(key);
83 pos_or_propL<typename prp2::vtype,prp2::prop>::value(p2.getVector(),key) = v_exp2.value(key);
84 pos_or_propL<typename prp3::vtype,prp3::prop>::value(p3.getVector(),key) = v_exp3.value(key);
85
86 ++it;
87 }
88}
89
90template<typename prp1, typename expr1,
91 typename prp2, typename expr2,
92 typename prp3, typename expr3,
93 typename prp4, typename expr4>
94void assign(prp1 & p1, const expr1 & v_e1,
95 prp2 & p2, const expr2 & v_e2,
96 prp3 & p3, const expr3 & v_e3,
97 prp4 & p4, const expr4 & v_e4)
98{
100 auto v_exp2 = construct_expression<expr2>::construct(v_e2);
101 auto v_exp3 = construct_expression<expr3>::construct(v_e3);
102 auto v_exp4 = construct_expression<expr4>::construct(v_e4);
103
104 v_exp1.init();
105 v_exp2.init();
106 v_exp3.init();
107 v_exp4.init();
108
109 auto it = p1.getVector().getDomainIterator();
110
111 while (it.isNext())
112 {
113 auto key = it.get();
114
115 pos_or_propL<typename prp1::vtype,prp1::prop>::value(p1.getVector(),key) = v_exp1.value(key);
116 pos_or_propL<typename prp2::vtype,prp2::prop>::value(p2.getVector(),key) = v_exp2.value(key);
117 pos_or_propL<typename prp3::vtype,prp3::prop>::value(p3.getVector(),key) = v_exp3.value(key);
118 pos_or_propL<typename prp4::vtype,prp4::prop>::value(p4.getVector(),key) = v_exp4.value(key);
119
120 ++it;
121 }
122}
123
124
125template<typename prp1, typename expr1,
126 typename prp2, typename expr2,
127 typename prp3, typename expr3,
128 typename prp4, typename expr4,
129 typename prp5, typename expr5>
130void assign(prp1 & p1, const expr1 & v_e1,
131 prp2 & p2, const expr2 & v_e2,
132 prp3 & p3, const expr3 & v_e3,
133 prp4 & p4, const expr4 & v_e4,
134 prp5 & p5, const expr5 & v_e5)
135{
136 auto v_exp1 = construct_expression<expr1>::construct(v_e1);
137 auto v_exp2 = construct_expression<expr2>::construct(v_e2);
138 auto v_exp3 = construct_expression<expr3>::construct(v_e3);
139 auto v_exp4 = construct_expression<expr4>::construct(v_e4);
140 auto v_exp5 = construct_expression<expr5>::construct(v_e5);
141
142 v_exp1.init();
143 v_exp2.init();
144 v_exp3.init();
145 v_exp4.init();
146 v_exp5.init();
147
148 auto it = p1.getVector().getDomainIterator();
149
150 while (it.isNext())
151 {
152 auto key = it.get();
153
154 pos_or_propL<typename prp1::vtype,prp1::prop>::value(p1.getVector(),key) = v_exp1.value(key);
155 pos_or_propL<typename prp2::vtype,prp2::prop>::value(p2.getVector(),key) = v_exp2.value(key);
156 pos_or_propL<typename prp3::vtype,prp3::prop>::value(p3.getVector(),key) = v_exp3.value(key);
157 pos_or_propL<typename prp4::vtype,prp4::prop>::value(p4.getVector(),key) = v_exp4.value(key);
158 pos_or_propL<typename prp5::vtype,prp5::prop>::value(p5.getVector(),key) = v_exp5.value(key);
159
160 ++it;
161 }
162}
163
164template<typename prp1, typename expr1,
165 typename prp2, typename expr2,
166 typename prp3, typename expr3,
167 typename prp4, typename expr4,
168 typename prp5, typename expr5,
169 typename prp6, typename expr6>
170void assign(prp1 & p1, const expr1 & v_e1,
171 prp2 & p2, const expr2 & v_e2,
172 prp3 & p3, const expr3 & v_e3,
173 prp4 & p4, const expr4 & v_e4,
174 prp5 & p5, const expr5 & v_e5,
175 prp6 & p6, const expr6 & v_e6)
176{
177 auto v_exp1 = construct_expression<expr1>::construct(v_e1);
178 auto v_exp2 = construct_expression<expr2>::construct(v_e2);
179 auto v_exp3 = construct_expression<expr3>::construct(v_e3);
180 auto v_exp4 = construct_expression<expr4>::construct(v_e4);
181 auto v_exp5 = construct_expression<expr5>::construct(v_e5);
182 auto v_exp6 = construct_expression<expr6>::construct(v_e6);
183
184 v_exp1.init();
185 v_exp2.init();
186 v_exp3.init();
187 v_exp4.init();
188 v_exp5.init();
189 v_exp6.init();
190
191 auto it = p1.getVector().getDomainIterator();
192
193 while (it.isNext())
194 {
195 auto key = it.get();
196
197 pos_or_propL<typename prp1::vtype,prp1::prop>::value(p1.getVector(),key) = v_exp1.value(key);
198 pos_or_propL<typename prp2::vtype,prp2::prop>::value(p2.getVector(),key) = v_exp2.value(key);
199 pos_or_propL<typename prp3::vtype,prp3::prop>::value(p3.getVector(),key) = v_exp3.value(key);
200 pos_or_propL<typename prp4::vtype,prp4::prop>::value(p4.getVector(),key) = v_exp4.value(key);
201 pos_or_propL<typename prp5::vtype,prp5::prop>::value(p5.getVector(),key) = v_exp5.value(key);
202 pos_or_propL<typename prp6::vtype,prp6::prop>::value(p6.getVector(),key) = v_exp6.value(key);
203
204 ++it;
205 }
206}
207
208
209
210template<typename prp1, typename expr1,
211 typename prp2, typename expr2,
212 typename prp3, typename expr3,
213 typename prp4, typename expr4,
214 typename prp5, typename expr5,
215 typename prp6, typename expr6,
216 typename prp7, typename expr7>
217void assign(prp1 & p1, const expr1 & v_e1,
218 prp2 & p2, const expr2 & v_e2,
219 prp3 & p3, const expr3 & v_e3,
220 prp4 & p4, const expr4 & v_e4,
221 prp5 & p5, const expr5 & v_e5,
222 prp6 & p6, const expr6 & v_e6,
223 prp7 & p7, const expr7 & v_e7)
224{
225 auto v_exp1 = construct_expression<expr1>::construct(v_e1);
226 auto v_exp2 = construct_expression<expr2>::construct(v_e2);
227 auto v_exp3 = construct_expression<expr3>::construct(v_e3);
228 auto v_exp4 = construct_expression<expr4>::construct(v_e4);
229 auto v_exp5 = construct_expression<expr5>::construct(v_e5);
230 auto v_exp6 = construct_expression<expr6>::construct(v_e6);
231 auto v_exp7 = construct_expression<expr7>::construct(v_e7);
232
233 v_exp1.init();
234 v_exp2.init();
235 v_exp3.init();
236 v_exp4.init();
237 v_exp5.init();
238 v_exp6.init();
239 v_exp7.init();
240
241 auto it = p1.getVector().getDomainIterator();
242
243 while (it.isNext())
244 {
245 auto key = it.get();
246
247 pos_or_propL<typename prp1::vtype,prp1::prop>::value(p1.getVector(),key) = v_exp1.value(key);
248 pos_or_propL<typename prp2::vtype,prp2::prop>::value(p2.getVector(),key) = v_exp2.value(key);
249 pos_or_propL<typename prp3::vtype,prp3::prop>::value(p3.getVector(),key) = v_exp3.value(key);
250 pos_or_propL<typename prp4::vtype,prp4::prop>::value(p4.getVector(),key) = v_exp4.value(key);
251 pos_or_propL<typename prp5::vtype,prp5::prop>::value(p5.getVector(),key) = v_exp5.value(key);
252 pos_or_propL<typename prp6::vtype,prp6::prop>::value(p6.getVector(),key) = v_exp6.value(key);
253 pos_or_propL<typename prp7::vtype,prp7::prop>::value(p7.getVector(),key) = v_exp7.value(key);
254
255 ++it;
256 }
257}
258
259
260template<typename prp1, typename expr1,
261 typename prp2, typename expr2,
262 typename prp3, typename expr3,
263 typename prp4, typename expr4,
264 typename prp5, typename expr5,
265 typename prp6, typename expr6,
266 typename prp7, typename expr7,
267 typename prp8, typename expr8>
268void assign(prp1 & p1, const expr1 & v_e1,
269 prp2 & p2, const expr2 & v_e2,
270 prp3 & p3, const expr3 & v_e3,
271 prp4 & p4, const expr4 & v_e4,
272 prp5 & p5, const expr5 & v_e5,
273 prp6 & p6, const expr6 & v_e6,
274 prp7 & p7, const expr7 & v_e7,
275 prp8 & p8, const expr8 & v_e8)
276{
277 auto v_exp1 = construct_expression<expr1>::construct(v_e1);
278 auto v_exp2 = construct_expression<expr2>::construct(v_e2);
279 auto v_exp3 = construct_expression<expr3>::construct(v_e3);
280 auto v_exp4 = construct_expression<expr4>::construct(v_e4);
281 auto v_exp5 = construct_expression<expr5>::construct(v_e5);
282 auto v_exp6 = construct_expression<expr6>::construct(v_e6);
283 auto v_exp7 = construct_expression<expr7>::construct(v_e7);
284 auto v_exp8 = construct_expression<expr8>::construct(v_e8);
285
286 v_exp1.init();
287 v_exp2.init();
288 v_exp3.init();
289 v_exp4.init();
290 v_exp5.init();
291 v_exp6.init();
292 v_exp7.init();
293 v_exp8.init();
294
295 auto it = p1.getVector().getDomainIterator();
296
297 while (it.isNext())
298 {
299 auto key = it.get();
300
301 pos_or_propL<typename prp1::vtype,prp1::prop>::value(p1.getVector(),key) = v_exp1.value(key);
302 pos_or_propL<typename prp2::vtype,prp2::prop>::value(p2.getVector(),key) = v_exp2.value(key);
303 pos_or_propL<typename prp3::vtype,prp3::prop>::value(p3.getVector(),key) = v_exp3.value(key);
304 pos_or_propL<typename prp4::vtype,prp4::prop>::value(p4.getVector(),key) = v_exp4.value(key);
305 pos_or_propL<typename prp5::vtype,prp5::prop>::value(p5.getVector(),key) = v_exp5.value(key);
306 pos_or_propL<typename prp6::vtype,prp6::prop>::value(p6.getVector(),key) = v_exp6.value(key);
307 pos_or_propL<typename prp7::vtype,prp7::prop>::value(p7.getVector(),key) = v_exp7.value(key);
308 pos_or_propL<typename prp8::vtype,prp8::prop>::value(p8.getVector(),key) = v_exp8.value(key);
309
310 ++it;
311 }
312}
313
314#endif /* OPENFPM_NUMERICS_SRC_OPERATORS_VECTOR_VECTOR_DIST_OPERATOR_ASSIGN_HPP_ */
Main class that encapsulate a vector properties operand to be used for expressions construction.
static vector_dist_expression< 0, double > construct(double e)
It return an expression from a double.
static vector_dist_expression< 0, float > construct(const float e)
It return an expression from a float.
static const T & construct(const T &e)
It return the expression itself.
__device__ static __host__ auto value(vector &v, const vect_dist_key_dx &k) -> decltype(v.template getProp< prp >(k))
return the value (position or property) of the particle k in the vector v