OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
boost_vector_algebra_ofp.hpp
1 //
2 // Created by Abhinav Singh on 18.02.21.
3 //
4 
5 #ifndef OPENFPM_PDATA_BOOST_VECTOR_ALGEBRA_OFP_HPP
6 #define OPENFPM_PDATA_BOOST_VECTOR_ALGEBRA_OFP_HPP
7 
8 namespace boost {
9  namespace numeric {
10  namespace odeint {
11 
12 /*
13  * This class template has to be overload in order to call vector_space_algebra::norm_inf
14  */
15  // template< class State, class Enabler = void > struct vector_space_norm_inf;
16 
17 /*
18  * Example: instantiation for sole doubles and complex
19  */
20 /* template<>
21  struct vector_space_norm_inf< double >
22  {
23  typedef double result_type;
24  double operator()( double x ) const
25  {
26  using std::abs;
27  return abs(x);
28  }
29  };
30 
31  template<>
32  struct vector_space_norm_inf< float >
33  {
34  typedef float result_type;
35  result_type operator()( float x ) const
36  {
37  using std::abs;
38  return abs(x);
39  }
40  };
41 
42  template< typename T >
43  struct vector_space_norm_inf< std::complex<T> >
44  {
45  typedef T result_type;
46  result_type operator()( std::complex<T> x ) const
47  {
48  using std::abs;
49  return abs( x );
50  }
51  };*/
52 
53  template<typename S1,typename S2>
55  S1 &v1;
56  S2 &v2;
64  inline for_each_prop_resize(S1 &v1,S2 &v2)
65  :v1(v1),v2(v2)
66  {};
68  template<typename T>
69  inline void operator()(T& t) const
70  {
71  v1.data.template get<T::value>().getVector().resize(v2.data.template get<T::value>().getVector().size());
72  }
73 
74  };
75 
76  /* It copy one element of the chunk for each property
77  *
78  */
79  template<typename vector_type,typename index_type,typename op_type>
81  {
82 
83  vector_type &v;
84  index_type &p;
85  op_type &op;
93  inline for_each_prop1(vector_type &v,index_type &p,op_type &op)
94  :v(v),p(p),op(op)
95  {};
97  template<typename T>
98  inline void operator()(T& t) const
99  {
100 
101  op(v.data.template get<T::value>().getVector().template get<0>(p));
102  }
103  };
104 
106  {
107  template< class S1 , class Op >
108  static void for_each1( S1 &s1 , Op op )
109  {
110 
111  // ToDo : build checks, that the +-*/ operators are well defined
112  auto it=s1.data.template get<0>().getVector().getIterator();
113  while(it.isNext()){
114  auto p=it.get();
115  //converting to boost vector ids.
116  for_each_prop1<S1,size_t,Op> cp(s1,p,op);
117  //creating an iterator on v_ids[0] [1] [2]
118  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype( s1.data)::max_prop>>(cp);
119 
120  ++it;
121  }
122  }
123 
124 
125  template<typename S1,typename S2,typename index_type,typename op_type>
127  {
128 
129  S1 &v1;
130  S2 &v2;
131  index_type &p;
132  op_type &op;
140  inline for_each_prop2(S1 &v1,S2 &v2,index_type &p,op_type &op)
141  :v1(v1),v2(v2),p(p),op(op)
142  {};
144  template<typename T>
145  inline void operator()(T& t) const
146  {
147  op(v1.data.template get<T::value>().getVector().template get<0>(p),v2.data.template get<T::value>().getVector().template get<0>(p));
148  }
149  };
150  template< class S1 , class S2 , class Op >
151  static void for_each2( S1 &s1 , S2 &s2 , Op op )
152  {
153  for_each_prop_resize<S1,S2> the_resize(s1,s2);
154  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype(s1.data)::max_prop>>(the_resize);
155  //s1.data.template get<0>().getVector().resize(s2.data.template get<0>().getVector().size());
156  // ToDo : build checks, that the +-*/ operators are well defined
157  auto it=s1.data.template get<0>().getVector().getIterator();
158  while(it.isNext()){
159  auto p=it.get();
160  //converting to boost vector ids.
161  for_each_prop2<S1,S2,size_t,Op> cp(s1,s2,p,op);
162  //creating an iterator on v_ids[0] [1] [2]
163  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype( s1.data)::max_prop>>(cp);
164 
165  ++it;
166  }
167  }
168 
169 
170 
171  template<typename S1,typename S2,typename S3,typename index_type,typename op_type>
173  {
174 
175  S1 &v1;
176  S2 &v2;
177  S3 &v3;
178  index_type &p;
179  op_type &op;
187  inline for_each_prop3(S1 &v1,S2 &v2,S3 &v3,index_type &p,op_type &op)
188  :v1(v1),v2(v2),v3(v3),p(p),op(op)
189  {};
191  template<typename T>
192  inline void operator()(T& t) const
193  {
194  //std::cout<<v1.data.template get<T::value>().getVector().size()<<":"<<v2.data.template get<T::value>().getVector().size()<<":"<<v3.data.template get<T::value>().getVector().size()<<std::endl;
195  op(v1.data.template get<T::value>().getVector().template get<0>(p),v2.data.template get<T::value>().getVector().template get<0>(p),v3.data.template get<T::value>().getVector().template get<0>(p));
196  }
197  };
198 
199 
200  template< class S1 , class S2 , class S3 , class Op >
201  static void for_each3( S1 &s1 , S2 &s2 , S3 &s3 , Op op )
202  {
203 
204 //
205  for_each_prop_resize<S1,S2> the_resize(s1,s2);
206  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype( s1.data)::max_prop>>(the_resize);
207  // ToDo : build checks, that the +-*/ operators are well defined
208  auto it=s1.data.template get<0>().getVector().getIterator();
209  while(it.isNext()){
210  auto p=it.get();
211  //converting to boost vector ids.
212  for_each_prop3<S1,S2,S3,size_t,Op> cp(s1,s2,s3,p,op);
213  //creating an iterator on v_ids[0] [1] [2]
214  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype( s1.data)::max_prop>>(cp);
215 
216  ++it;
217  }
218  }
219 
220 
221  template<typename S1,typename S2,typename S3,typename S4,typename index_type,typename op_type>
223  {
224 
225  S1 &v1;
226  S2 &v2;
227  S3 &v3;
228  S4 &v4;
229 
230  index_type &p;
231  op_type &op;
239  inline for_each_prop4(S1 &v1,S2 &v2,S3 &v3,S4 &v4,index_type &p,op_type &op)
240  :v1(v1),v2(v2),v3(v3),v4(v4),p(p),op(op)
241  {};
243  template<typename T>
244  inline void operator()(T& t) const
245  {
246  op(v1.data.template get<T::value>().getVector().template get<0>(p),v2.data.template get<T::value>().getVector().template get<0>(p),v3.data.template get<T::value>().getVector().template get<0>(p),v4.data.template get<T::value>().getVector().template get<0>(p));
247  }
248  };
249 
250  template< class S1 , class S2 , class S3 , class S4 , class Op >
251  static void for_each4( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , Op op )
252  {
253  for_each_prop_resize<S1,S2> the_resize(s1,s2);
254  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype(s1.data)::max_prop>>(the_resize);
255  // ToDo : build checks, that the +-*/ operators are well defined
256  auto it=s1.data.template get<0>().getVector().getIterator();
257  while(it.isNext()){
258  auto p=it.get();
259  //converting to boost vector ids.
260  for_each_prop4<S1,S2,S3,S4,size_t,Op> cp(s1,s2,s3,s4,p,op);
261  //creating an iterator on v_ids[0] [1] [2]
262  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype( s1.data)::max_prop>>(cp);
263 
264  ++it;
265  }
266  }
267 
268 
269  template<typename S1,typename S2,typename S3,typename S4,typename S5,typename index_type,typename op_type>
271  {
272 
273  S1 &v1;
274  S2 &v2;
275  S3 &v3;
276  S4 &v4;
277  S5 &v5;
278 
279  index_type &p;
280  op_type &op;
288  inline for_each_prop5(S1 &v1,S2 &v2,S3 &v3,S4 &v4,S5 &v5,index_type &p,op_type &op)
289  :v1(v1),v2(v2),v3(v3),v4(v4),v5(v5),p(p),op(op)
290  {};
292  template<typename T>
293  inline void operator()(T& t) const
294  {
295  op(v1.data.template get<T::value>().getVector().template get<0>(p),v2.data.template get<T::value>().getVector().template get<0>(p),v3.data.template get<T::value>().getVector().template get<0>(p),v4.data.template get<T::value>().getVector().template get<0>(p),v5.data.template get<T::value>().getVector().template get<0>(p));
296  }
297  };
298 
299  template< class S1 , class S2 , class S3 , class S4,class S5 , class Op >
300  static void for_each5( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4,S5 &s5 , Op op )
301  {
302  for_each_prop_resize<S1,S2> the_resize(s1,s2);
303  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype(s1.data)::max_prop>>(the_resize);
304  // ToDo : build checks, that the +-*/ operators are well defined
305  auto it=s1.data.template get<0>().getVector().getIterator();
306  while(it.isNext()){
307  auto p=it.get();
308  //converting to boost vector ids.
309  for_each_prop5<S1,S2,S3,S4,S5,size_t,Op> cp(s1,s2,s3,s4,s5,p,op);
310  //creating an iterator on v_ids[0] [1] [2]
311  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype( s1.data)::max_prop>>(cp);
312 
313  ++it;
314  }
315  }
316 
317 
318  template<typename S1,typename S2,typename S3,typename S4,typename S5,typename S6,typename index_type,typename op_type>
320  {
321 
322  S1 &v1;
323  S2 &v2;
324  S3 &v3;
325  S4 &v4;
326  S5 &v5;
327  S6 &v6;
328 
329 
330  index_type &p;
331  op_type &op;
339  inline for_each_prop6(S1 &v1,S2 &v2,S3 &v3,S4 &v4,S5 &v5,S6 &v6,index_type &p,op_type &op)
340  :v1(v1),v2(v2),v3(v3),v4(v4),v5(v5),v6(v6),p(p),op(op)
341  {};
343  template<typename T>
344  inline void operator()(T& t) const
345  {
346  op(v1.data.template get<T::value>().getVector().template get<0>(p),v2.data.template get<T::value>().getVector().template get<0>(p),v3.data.template get<T::value>().getVector().template get<0>(p),v4.data.template get<T::value>().getVector().template get<0>(p),v5.data.template get<T::value>().getVector().template get<0>(p),v6.data.template get<T::value>().getVector().template get<0>(p));
347  }
348  };
349  template< class S1 , class S2 , class S3 , class S4,class S5,class S6 , class Op >
350  static void for_each6( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4,S5 &s5,S6 &s6 , Op op )
351  {
352  for_each_prop_resize<S1,S2> the_resize(s1,s2);
353  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype(s1.data)::max_prop>>(the_resize);
354  // ToDo : build checks, that the +-*/ operators are well defined
355  auto it=s1.data.template get<0>().getVector().getIterator();
356  while(it.isNext()){
357  auto p=it.get();
358  //converting to boost vector ids.
359  for_each_prop6<S1,S2,S3,S4,S5,S6,size_t,Op> cp(s1,s2,s3,s4,s5,s6,p,op);
360  //creating an iterator on v_ids[0] [1] [2]
361  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype( s1.data)::max_prop>>(cp);
362 
363  ++it;
364  }
365  }
366 
367 
368 
369  template<typename S1,typename S2,typename S3,typename S4,typename S5,typename S6,typename S7,typename index_type,typename op_type>
371  {
372 
373  S1 &v1;
374  S2 &v2;
375  S3 &v3;
376  S4 &v4;
377  S5 &v5;
378  S6 &v6;
379  S7 &v7;
380 
381 
382  index_type &p;
383  op_type &op;
391  inline for_each_prop7(S1 &v1,S2 &v2,S3 &v3,S4 &v4,S5 &v5,S6 &v6,S7 &v7,index_type &p,op_type &op)
392  :v1(v1),v2(v2),v3(v3),v4(v4),v5(v5),v6(v6),v7(v7),p(p),op(op)
393  {};
395  template<typename T>
396  inline void operator()(T& t) const
397  {
398  op(v1.data.template get<T::value>().getVector().template get<0>(p),v2.data.template get<T::value>().getVector().template get<0>(p),v3.data.template get<T::value>().getVector().template get<0>(p),v4.data.template get<T::value>().getVector().template get<0>(p),v5.data.template get<T::value>().getVector().template get<0>(p),v6.data.template get<T::value>().getVector().template get<0>(p),v7.data.template get<T::value>().getVector().template get<0>(p));
399  }
400  };
401 
402 
403  template< class S1 , class S2 , class S3 , class S4,class S5,class S6 ,class S7, class Op >
404  static void for_each7( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4,S5 &s5,S6 &s6,S7 &s7 , Op op )
405  {
406  for_each_prop_resize<S1,S2> the_resize(s1,s2);
407  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype(s1.data)::max_prop>>(the_resize);
408  // ToDo : build checks, that the +-*/ operators are well defined
409  auto it=s1.data.template get<0>().getVector().getIterator();
410  while(it.isNext()){
411  auto p=it.get();
412  //converting to boost vector ids.
413  for_each_prop7<S1,S2,S3,S4,S5,S6,S7,size_t,Op> cp(s1,s2,s3,s4,s5,s6,s7,p,op);
414  //creating an iterator on v_ids[0] [1] [2]
415  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype( s1.data)::max_prop>>(cp);
416 
417  ++it;
418  }
419  }
420 
421  template<typename S1,typename S2,typename S3,typename S4,typename S5,typename S6,typename S7,typename S8,typename index_type,typename op_type>
423  {
424 
425  S1 &v1;
426  S2 &v2;
427  S3 &v3;
428  S4 &v4;
429  S5 &v5;
430  S6 &v6;
431  S7 &v7;
432  S8 &v8;
433 
434 
435  index_type &p;
436  op_type &op;
444  inline for_each_prop8(S1 &v1,S2 &v2,S3 &v3,S4 &v4,S5 &v5,S6 &v6,S7 &v7,S8 &v8,index_type &p,op_type &op)
445  :v1(v1),v2(v2),v3(v3),v4(v4),v5(v5),v6(v6),v7(v7),v8(v8),p(p),op(op)
446  {};
448  template<typename T>
449  inline void operator()(T& t) const
450  {
451  op(v1.data.template get<T::value>().getVector().template get<0>(p),v2.data.template get<T::value>().getVector().template get<0>(p),v3.data.template get<T::value>().getVector().template get<0>(p),v4.data.template get<T::value>().getVector().template get<0>(p),v5.data.template get<T::value>().getVector().template get<0>(p),v6.data.template get<T::value>().getVector().template get<0>(p),v7.data.template get<T::value>().getVector().template get<0>(p),v8.data.template get<T::value>().getVector().template get<0>(p));
452  }
453  };
454 
455 
456  template< class S1 , class S2 , class S3 , class S4,class S5,class S6 ,class S7,class S8, class Op >
457  static void for_each8( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4,S5 &s5,S6 &s6,S7 &s7,S8 &s8 , Op op )
458  {
459  for_each_prop_resize<S1,S2> the_resize(s1,s2);
460  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype(s1.data)::max_prop>>(the_resize);
461  // ToDo : build checks, that the +-*/ operators are well defined
462  auto it=s1.data.template get<0>().getVector().getIterator();
463  while(it.isNext()){
464  auto p=it.get();
465  //converting to boost vector ids.
466  for_each_prop8<S1,S2,S3,S4,S5,S6,S7,S8,size_t,Op> cp(s1,s2,s3,s4,s5,s6,s7,s8,p,op);
467  //creating an iterator on v_ids[0] [1] [2]
468  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype( s1.data)::max_prop>>(cp);
469 
470  ++it;
471  }
472  }
473 
474  template<typename S1,typename S2,typename S3,typename S4,typename S5,typename S6,typename S7,typename S8, typename S9,typename index_type,typename op_type>
476  {
477 
478  S1 &v1;
479  S2 &v2;
480  S3 &v3;
481  S4 &v4;
482  S5 &v5;
483  S6 &v6;
484  S7 &v7;
485  S8 &v8;
486  S9 &v9;
487 
488 
489  index_type &p;
490  op_type &op;
498  inline for_each_prop9(S1 &v1,S2 &v2,S3 &v3,S4 &v4,S5 &v5,S6 &v6,S7 &v7,S8 &v8,S9 &v9,index_type &p,op_type &op)
499  :v1(v1),v2(v2),v3(v3),v4(v4),v5(v5),v6(v6),v7(v7),v8(v8),v9(v9),p(p),op(op)
500  {};
502  template<typename T>
503  inline void operator()(T& t) const
504  {
505  op(v1.data.template get<T::value>().getVector().template get<0>(p),v2.data.template get<T::value>().getVector().template get<0>(p),v3.data.template get<T::value>().getVector().template get<0>(p),v4.data.template get<T::value>().getVector().template get<0>(p),v5.data.template get<T::value>().getVector().template get<0>(p),v6.data.template get<T::value>().getVector().template get<0>(p),v7.data.template get<T::value>().getVector().template get<0>(p),v8.data.template get<T::value>().getVector().template get<0>(p),v9.data.template get<T::value>().getVector().template get<0>(p));
506  }
507  };
508 
509 
510  template< class S1 , class S2 , class S3 , class S4,class S5,class S6 ,class S7,class S8, class S9, class Op >
511  static void for_each9( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4,S5 &s5,S6 &s6,S7 &s7,S8 &s8, S9 &s9 , Op op )
512  {
513  for_each_prop_resize<S1,S2> the_resize(s1,s2);
514  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype(s1.data)::max_prop>>(the_resize);
515  // ToDo : build checks, that the +-*/ operators are well defined
516  auto it=s1.data.template get<0>().getVector().getIterator();
517  while(it.isNext()){
518  auto p=it.get();
519  //converting to boost vector ids.
520  for_each_prop9<S1,S2,S3,S4,S5,S6,S7,S8,S9,size_t,Op> cp(s1,s2,s3,s4,s5,s6,s7,s8,s9,p,op);
521  //creating an iterator on v_ids[0] [1] [2]
522  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype( s1.data)::max_prop>>(cp);
523 
524  ++it;
525  }
526  }
527 
528  template<typename S1,typename S2,typename S3,typename S4,typename S5,typename S6,typename S7,typename S8, typename S9, typename S10,typename index_type,typename op_type>
530  {
531 
532  S1 &v1;
533  S2 &v2;
534  S3 &v3;
535  S4 &v4;
536  S5 &v5;
537  S6 &v6;
538  S7 &v7;
539  S8 &v8;
540  S9 &v9;
541  S10 &v10;
542 
543 
544  index_type &p;
545  op_type &op;
553  inline for_each_prop10(S1 &v1,S2 &v2,S3 &v3,S4 &v4,S5 &v5,S6 &v6,S7 &v7,S8 &v8,S9 &v9,S10 &v10,index_type &p,op_type &op)
554  :v1(v1),v2(v2),v3(v3),v4(v4),v5(v5),v6(v6),v7(v7),v8(v8),v9(v9),v10(v10),p(p),op(op)
555  {};
557  template<typename T>
558  inline void operator()(T& t) const
559  {
560  op(v1.data.template get<T::value>().getVector().template get<0>(p),v2.data.template get<T::value>().getVector().template get<0>(p),v3.data.template get<T::value>().getVector().template get<0>(p),v4.data.template get<T::value>().getVector().template get<0>(p),v5.data.template get<T::value>().getVector().template get<0>(p),v6.data.template get<T::value>().getVector().template get<0>(p),v7.data.template get<T::value>().getVector().template get<0>(p),v8.data.template get<T::value>().getVector().template get<0>(p),v9.data.template get<T::value>().getVector().template get<0>(p),v10.data.template get<T::value>().getVector().template get<0>(p));
561  }
562  };
563 
564 
565  template< class S1 , class S2 , class S3 , class S4,class S5,class S6 ,class S7,class S8, class S9, class S10, class Op >
566  static void for_each10( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4,S5 &s5,S6 &s6,S7 &s7,S8 &s8, S9 &s9 , S10 &s10, Op op )
567  {
568  for_each_prop_resize<S1,S2> the_resize(s1,s2);
569  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype(s1.data)::max_prop>>(the_resize);
570  // ToDo : build checks, that the +-*/ operators are well defined
571  auto it=s1.data.template get<0>().getVector().getIterator();
572  while(it.isNext()){
573  auto p=it.get();
574  //converting to boost vector ids.
575  for_each_prop10<S1,S2,S3,S4,S5,S6,S7,S8,S9,S10,size_t,Op> cp(s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,p,op);
576  //creating an iterator on v_ids[0] [1] [2]
577  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype( s1.data)::max_prop>>(cp);
578 
579  ++it;
580  }
581  }
582 
583  template<typename S1,typename S2,typename S3,typename S4,typename S5,typename S6,typename S7,typename S8, typename S9, typename S10, typename S11,typename index_type,typename op_type>
585  {
586 
587  S1 &v1;
588  S2 &v2;
589  S3 &v3;
590  S4 &v4;
591  S5 &v5;
592  S6 &v6;
593  S7 &v7;
594  S8 &v8;
595  S9 &v9;
596  S10 &v10;
597  S11 &v11;
598 
599 
600  index_type &p;
601  op_type &op;
609  inline for_each_prop11(S1 &v1,S2 &v2,S3 &v3,S4 &v4,S5 &v5,S6 &v6,S7 &v7,S8 &v8,S9 &v9,S10 &v10, S11 &v11,index_type &p,op_type &op)
610  :v1(v1),v2(v2),v3(v3),v4(v4),v5(v5),v6(v6),v7(v7),v8(v8),v9(v9),v10(v10),v11(v11),p(p),op(op)
611  {};
613  template<typename T>
614  inline void operator()(T& t) const
615  {
616  op(v1.data.template get<T::value>().getVector().template get<0>(p),v2.data.template get<T::value>().getVector().template get<0>(p),v3.data.template get<T::value>().getVector().template get<0>(p),v4.data.template get<T::value>().getVector().template get<0>(p),v5.data.template get<T::value>().getVector().template get<0>(p),v6.data.template get<T::value>().getVector().template get<0>(p),v7.data.template get<T::value>().getVector().template get<0>(p),v8.data.template get<T::value>().getVector().template get<0>(p),v9.data.template get<T::value>().getVector().template get<0>(p),v10.data.template get<T::value>().getVector().template get<0>(p),v11.data.template get<T::value>().getVector().template get<0>(p));
617  }
618  };
619 
620 
621  template< class S1 , class S2 , class S3 , class S4,class S5,class S6 ,class S7,class S8, class S9, class S10, class S11, class Op >
622  static void for_each11( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4,S5 &s5,S6 &s6,S7 &s7,S8 &s8, S9 &s9 , S10 &s10,S11 &s11, Op op )
623  {
624  for_each_prop_resize<S1,S2> the_resize(s1,s2);
625  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype(s1.data)::max_prop>>(the_resize);
626  // ToDo : build checks, that the +-*/ operators are well defined
627  auto it=s1.data.template get<0>().getVector().getIterator();
628  while(it.isNext()){
629  auto p=it.get();
630  //converting to boost vector ids.
631  for_each_prop11<S1,S2,S3,S4,S5,S6,S7,S8,S9,S10,S11,size_t,Op> cp(s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,p,op);
632  //creating an iterator on v_ids[0] [1] [2]
633  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype( s1.data)::max_prop>>(cp);
634 
635  ++it;
636  }
637  }
638 
639  template<typename S1,typename S2,typename S3,typename S4,typename S5,typename S6,typename S7,typename S8, typename S9, typename S10, typename S11, typename S12,typename index_type,typename op_type>
641  {
642 
643  S1 &v1;
644  S2 &v2;
645  S3 &v3;
646  S4 &v4;
647  S5 &v5;
648  S6 &v6;
649  S7 &v7;
650  S8 &v8;
651  S9 &v9;
652  S10 &v10;
653  S11 &v11;
654  S12 &v12;
655 
656 
657  index_type &p;
658  op_type &op;
666  inline for_each_prop12(S1 &v1,S2 &v2,S3 &v3,S4 &v4,S5 &v5,S6 &v6,S7 &v7,S8 &v8,S9 &v9,S10 &v10, S11 &v11,S12 &v12,index_type &p,op_type &op)
667  :v1(v1),v2(v2),v3(v3),v4(v4),v5(v5),v6(v6),v7(v7),v8(v8),v9(v9),v10(v10),v11(v11), v12(v12),p(p),op(op)
668  {};
670  template<typename T>
671  inline void operator()(T& t) const
672  {
673  op(v1.data.template get<T::value>().getVector().template get<0>(p),v2.data.template get<T::value>().getVector().template get<0>(p),v3.data.template get<T::value>().getVector().template get<0>(p),v4.data.template get<T::value>().getVector().template get<0>(p),v5.data.template get<T::value>().getVector().template get<0>(p),v6.data.template get<T::value>().getVector().template get<0>(p),v7.data.template get<T::value>().getVector().template get<0>(p),v8.data.template get<T::value>().getVector().template get<0>(p),v9.data.template get<T::value>().getVector().template get<0>(p),v10.data.template get<T::value>().getVector().template get<0>(p),v11.data.template get<T::value>().getVector().template get<0>(p),v12.data.template get<T::value>().getVector().template get<0>(p));
674  }
675  };
676 
677 
678  template< class S1 , class S2 , class S3 , class S4,class S5,class S6 ,class S7,class S8, class S9, class S10, class S11, class S12, class Op >
679  static void for_each12( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4,S5 &s5,S6 &s6,S7 &s7,S8 &s8, S9 &s9 , S10 &s10,S11 &s11,S12 &s12, Op op )
680  {
681  for_each_prop_resize<S1,S2> the_resize(s1,s2);
682  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype(s1.data)::max_prop>>(the_resize);
683  // ToDo : build checks, that the +-*/ operators are well defined
684  auto it=s1.data.template get<0>().getVector().getIterator();
685  while(it.isNext()){
686  auto p=it.get();
687  //converting to boost vector ids.
688  for_each_prop12<S1,S2,S3,S4,S5,S6,S7,S8,S9,S10,S11,S12,size_t,Op> cp(s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,p,op);
689  //creating an iterator on v_ids[0] [1] [2]
690  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype( s1.data)::max_prop>>(cp);
691 
692  ++it;
693  }
694  }
695 
696  template<typename S1,typename S2,typename S3,typename S4,typename S5,typename S6,typename S7,typename S8, typename S9, typename S10, typename S11, typename S12, typename S13,typename index_type,typename op_type>
698  {
699 
700  S1 &v1;
701  S2 &v2;
702  S3 &v3;
703  S4 &v4;
704  S5 &v5;
705  S6 &v6;
706  S7 &v7;
707  S8 &v8;
708  S9 &v9;
709  S10 &v10;
710  S11 &v11;
711  S12 &v12;
712  S13 &v13;
713 
714 
715  index_type &p;
716  op_type &op;
724  inline for_each_prop13(S1 &v1,S2 &v2,S3 &v3,S4 &v4,S5 &v5,S6 &v6,S7 &v7,S8 &v8,S9 &v9,S10 &v10, S11 &v11,S12 &v12,S13 &v13,index_type &p,op_type &op)
725  :v1(v1),v2(v2),v3(v3),v4(v4),v5(v5),v6(v6),v7(v7),v8(v8),v9(v9),v10(v10),v11(v11), v12(v12),v13(v13),p(p),op(op)
726  {};
728  template<typename T>
729  inline void operator()(T& t) const
730  {
731  op(v1.data.template get<T::value>().getVector().template get<0>(p),v2.data.template get<T::value>().getVector().template get<0>(p),v3.data.template get<T::value>().getVector().template get<0>(p),v4.data.template get<T::value>().getVector().template get<0>(p),v5.data.template get<T::value>().getVector().template get<0>(p),v6.data.template get<T::value>().getVector().template get<0>(p),v7.data.template get<T::value>().getVector().template get<0>(p),v8.data.template get<T::value>().getVector().template get<0>(p),v9.data.template get<T::value>().getVector().template get<0>(p),v10.data.template get<T::value>().getVector().template get<0>(p),v11.data.template get<T::value>().getVector().template get<0>(p),v12.data.template get<T::value>().getVector().template get<0>(p),v13.data.template get<T::value>().getVector().template get<0>(p));
732  }
733  };
734 
735 
736  template< class S1 , class S2 , class S3 , class S4,class S5,class S6 ,class S7,class S8, class S9, class S10, class S11, class S12, class S13, class Op >
737  static void for_each13( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4,S5 &s5,S6 &s6,S7 &s7,S8 &s8, S9 &s9 , S10 &s10,S11 &s11,S12 &s12,S13 &s13, Op op )
738  {
739  for_each_prop_resize<S1,S2> the_resize(s1,s2);
740  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype(s1.data)::max_prop>>(the_resize);
741  // ToDo : build checks, that the +-*/ operators are well defined
742  auto it=s1.data.template get<0>().getVector().getIterator();
743  while(it.isNext()){
744  auto p=it.get();
745  //converting to boost vector ids.
746  for_each_prop13<S1,S2,S3,S4,S5,S6,S7,S8,S9,S10,S11,S12,S13,size_t,Op> cp(s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,p,op);
747  //creating an iterator on v_ids[0] [1] [2]
748  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype( s1.data)::max_prop>>(cp);
749 
750  ++it;
751  }
752  }
753 
754  template<typename S1,typename S2,typename S3,typename S4,typename S5,typename S6,typename S7,typename S8, typename S9, typename S10, typename S11, typename S12, typename S13, typename S14,typename index_type,typename op_type>
756  {
757 
758  S1 &v1;
759  S2 &v2;
760  S3 &v3;
761  S4 &v4;
762  S5 &v5;
763  S6 &v6;
764  S7 &v7;
765  S8 &v8;
766  S9 &v9;
767  S10 &v10;
768  S11 &v11;
769  S12 &v12;
770  S13 &v13;
771  S14 &v14;
772 
773 
774  index_type &p;
775  op_type &op;
783  inline for_each_prop14(S1 &v1,S2 &v2,S3 &v3,S4 &v4,S5 &v5,S6 &v6,S7 &v7,S8 &v8,S9 &v9,S10 &v10, S11 &v11,S12 &v12,S13 &v13,S14 &v14,index_type &p,op_type &op)
784  :v1(v1),v2(v2),v3(v3),v4(v4),v5(v5),v6(v6),v7(v7),v8(v8),v9(v9),v10(v10),v11(v11), v12(v12),v13(v13),v14(v14),p(p),op(op)
785  {};
787  template<typename T>
788  inline void operator()(T& t) const
789  {
790  op(v1.data.template get<T::value>().getVector().template get<0>(p),v2.data.template get<T::value>().getVector().template get<0>(p),v3.data.template get<T::value>().getVector().template get<0>(p),v4.data.template get<T::value>().getVector().template get<0>(p),v5.data.template get<T::value>().getVector().template get<0>(p),v6.data.template get<T::value>().getVector().template get<0>(p),v7.data.template get<T::value>().getVector().template get<0>(p),v8.data.template get<T::value>().getVector().template get<0>(p),v9.data.template get<T::value>().getVector().template get<0>(p),v10.data.template get<T::value>().getVector().template get<0>(p),v11.data.template get<T::value>().getVector().template get<0>(p),v12.data.template get<T::value>().getVector().template get<0>(p),v13.data.template get<T::value>().getVector().template get<0>(p),v14.data.template get<T::value>().getVector().template get<0>(p));
791  }
792  };
793 
794 
795  template< class S1 , class S2 , class S3 , class S4,class S5,class S6 ,class S7,class S8, class S9, class S10, class S11, class S12, class S13, class S14, class Op >
796  static void for_each14( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4,S5 &s5,S6 &s6,S7 &s7,S8 &s8, S9 &s9, S10 &s10,S11 &s11,S12 &s12,S13 &s13,S14 &s14, Op op )
797  {
798  for_each_prop_resize<S1,S2> the_resize(s1,s2);
799  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype(s1.data)::max_prop>>(the_resize);
800  // ToDo : build checks, that the +-*/ operators are well defined
801  auto it=s1.data.template get<0>().getVector().getIterator();
802  while(it.isNext()){
803  auto p=it.get();
804  //converting to boost vector ids.
805  for_each_prop14<S1,S2,S3,S4,S5,S6,S7,S8,S9,S10,S11,S12,S13,S14,size_t,Op> cp(s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,p,op);
806  //creating an iterator on v_ids[0] [1] [2]
807  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype( s1.data)::max_prop>>(cp);
808 
809  ++it;
810  }
811  }
812 
813  template<typename S1,typename S2,typename S3,typename S4,typename S5,typename S6,typename S7,typename S8, typename S9, typename S10, typename S11, typename S12, typename S13, typename S14, typename S15,typename index_type,typename op_type>
815  {
816 
817  S1 &v1;
818  S2 &v2;
819  S3 &v3;
820  S4 &v4;
821  S5 &v5;
822  S6 &v6;
823  S7 &v7;
824  S8 &v8;
825  S9 &v9;
826  S10 &v10;
827  S11 &v11;
828  S12 &v12;
829  S13 &v13;
830  S14 &v14;
831  S15 &v15;
832 
833 
834  index_type &p;
835  op_type &op;
843  inline for_each_prop15(S1 &v1,S2 &v2,S3 &v3,S4 &v4,S5 &v5,S6 &v6,S7 &v7,S8 &v8,S9 &v9,S10 &v10, S11 &v11,S12 &v12,S13 &v13,S14 &v14,S15 &v15,index_type &p,op_type &op)
844  :v1(v1),v2(v2),v3(v3),v4(v4),v5(v5),v6(v6),v7(v7),v8(v8),v9(v9),v10(v10),v11(v11), v12(v12),v13(v13),v14(v14),v15(v15),p(p),op(op)
845  {};
847  template<typename T>
848  inline void operator()(T& t) const
849  {
850  op(v1.data.template get<T::value>().getVector().template get<0>(p),v2.data.template get<T::value>().getVector().template get<0>(p),v3.data.template get<T::value>().getVector().template get<0>(p),v4.data.template get<T::value>().getVector().template get<0>(p),v5.data.template get<T::value>().getVector().template get<0>(p),v6.data.template get<T::value>().getVector().template get<0>(p),v7.data.template get<T::value>().getVector().template get<0>(p),v8.data.template get<T::value>().getVector().template get<0>(p),v9.data.template get<T::value>().getVector().template get<0>(p),v10.data.template get<T::value>().getVector().template get<0>(p),v11.data.template get<T::value>().getVector().template get<0>(p),v12.data.template get<T::value>().getVector().template get<0>(p),v13.data.template get<T::value>().getVector().template get<0>(p),v14.data.template get<T::value>().getVector().template get<0>(p),v15.data.template get<T::value>().getVector().template get<0>(p));
851  }
852  };
853 
854 
855  template< class S1 , class S2 , class S3 , class S4,class S5,class S6 ,class S7,class S8, class S9, class S10, class S11, class S12, class S13, class S14, class S15, class Op >
856  static void for_each15( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4,S5 &s5,S6 &s6,S7 &s7,S8 &s8, S9 &s9, S10 &s10,S11 &s11,S12 &s12,S13 &s13,S14 &s14,S15 &s15, Op op )
857  {
858  for_each_prop_resize<S1,S2> the_resize(s1,s2);
859  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype(s1.data)::max_prop>>(the_resize);
860  // ToDo : build checks, that the +-*/ operators are well defined
861  auto it=s1.data.template get<0>().getVector().getIterator();
862  while(it.isNext()){
863  auto p=it.get();
864  //converting to boost vector ids.
865  for_each_prop15<S1,S2,S3,S4,S5,S6,S7,S8,S9,S10,S11,S12,S13,S14,S15,size_t,Op> cp(s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,p,op);
866  //creating an iterator on v_ids[0] [1] [2]
867  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype( s1.data)::max_prop>>(cp);
868 
869  ++it;
870  }
871  }
872 
873 
874 
875 
876 
877 
878  template<typename vector_type,typename index_type,typename norm_result_type>
880  {
881  const vector_type &v;
882  index_type &p;
883  norm_result_type &n;
891  inline for_each_norm(const vector_type &v,index_type &p,norm_result_type &n)
892  :v(v),p(p),n(n)
893  {};
895  template<typename T>
896  inline void operator()(T& t) const
897  {
898  if(fabs(v.data.template get<T::value>().getVector().template get<0>(p)) > n)
899  {
900  n=fabs(v.data.template get<T::value>().getVector().template get<0>(p));
901  }
902 
903  }
904  };
905 
906  template< class S >
907  static typename boost::numeric::odeint::vector_space_norm_inf< S >::result_type norm_inf( const S &s )
908  {
909  typename boost::numeric::odeint::vector_space_norm_inf< S >::result_type n=0;
910  auto it=s.data.template get<0>().getVector().getIterator();
911  while(it.isNext()){
912  auto p=it.get();
913  //converting to boost vector ids.
914  for_each_norm<S,size_t,typename boost::numeric::odeint::vector_space_norm_inf< S >::result_type> cp(s,p,n);
915  //creating an iterator on v_ids[0] [1] [2]
916  boost::mpl::for_each_ref<boost::mpl::range_c<int,0,decltype(s.data)::max_prop>>(cp);
917 
918  ++it;
919  }
920  auto &v_cl = create_vcluster();
921  v_cl.max(n);
922  v_cl.execute();
923  //std::max();
924  //std::cout<<n<<std::endl;
925  return n;
926  }
927  };
928 
929 
930 
931  } // odeint
932 } // numeric
933 } // boost
934 
935 
936 
937 
938 
939 
940 
941 
942 #endif //OPENFPM_PDATA_BOOST_VECTOR_ALGEBRA_OFP_HPP
void operator()(T &t) const
It call the copy function for each property.
for_each_prop6(S1 &v1, S2 &v2, S3 &v3, S4 &v4, S5 &v5, S6 &v6, index_type &p, op_type &op)
constructor
for_each_prop7(S1 &v1, S2 &v2, S3 &v3, S4 &v4, S5 &v5, S6 &v6, S7 &v7, index_type &p, op_type &op)
constructor
void operator()(T &t) const
It call the copy function for each property.
for_each_prop9(S1 &v1, S2 &v2, S3 &v3, S4 &v4, S5 &v5, S6 &v6, S7 &v7, S8 &v8, S9 &v9, index_type &p, op_type &op)
constructor
void operator()(T &t) const
It call the copy function for each property.
void operator()(T &t) const
It call the copy function for each property.
void operator()(T &t) const
It call the copy function for each property.
for_each_prop12(S1 &v1, S2 &v2, S3 &v3, S4 &v4, S5 &v5, S6 &v6, S7 &v7, S8 &v8, S9 &v9, S10 &v10, S11 &v11, S12 &v12, index_type &p, op_type &op)
constructor
for_each_prop5(S1 &v1, S2 &v2, S3 &v3, S4 &v4, S5 &v5, index_type &p, op_type &op)
constructor
void operator()(T &t) const
It call the copy function for each property.
void operator()(T &t) const
It call the copy function for each property.
void operator()(T &t) const
It call the copy function for each property.
void operator()(T &t) const
It call the copy function for each property.
for_each_prop11(S1 &v1, S2 &v2, S3 &v3, S4 &v4, S5 &v5, S6 &v6, S7 &v7, S8 &v8, S9 &v9, S10 &v10, S11 &v11, index_type &p, op_type &op)
constructor
for_each_prop10(S1 &v1, S2 &v2, S3 &v3, S4 &v4, S5 &v5, S6 &v6, S7 &v7, S8 &v8, S9 &v9, S10 &v10, index_type &p, op_type &op)
constructor
void operator()(T &t) const
It call the copy function for each property.
KeyT const ValueT ValueT OffsetIteratorT OffsetIteratorT int
[in] The number of segments that comprise the sorting data
void operator()(T &t) const
It call the copy function for each property.
for_each_prop13(S1 &v1, S2 &v2, S3 &v3, S4 &v4, S5 &v5, S6 &v6, S7 &v7, S8 &v8, S9 &v9, S10 &v10, S11 &v11, S12 &v12, S13 &v13, index_type &p, op_type &op)
constructor
void operator()(T &t) const
It call the copy function for each property.
void operator()(T &t) const
It call the copy function for each property.
void operator()(T &t) const
It call the copy function for each property.
for_each_prop14(S1 &v1, S2 &v2, S3 &v3, S4 &v4, S5 &v5, S6 &v6, S7 &v7, S8 &v8, S9 &v9, S10 &v10, S11 &v11, S12 &v12, S13 &v13, S14 &v14, index_type &p, op_type &op)
constructor
for_each_prop3(S1 &v1, S2 &v2, S3 &v3, index_type &p, op_type &op)
constructor
for_each_prop15(S1 &v1, S2 &v2, S3 &v3, S4 &v4, S5 &v5, S6 &v6, S7 &v7, S8 &v8, S9 &v9, S10 &v10, S11 &v11, S12 &v12, S13 &v13, S14 &v14, S15 &v15, index_type &p, op_type &op)
constructor
Distributed vector.
void operator()(T &t) const
It call the copy function for each property.
void operator()(T &t) const
It call the copy function for each property.
for_each_norm(const vector_type &v, index_type &p, norm_result_type &n)
constructor
for_each_prop8(S1 &v1, S2 &v2, S3 &v3, S4 &v4, S5 &v5, S6 &v6, S7 &v7, S8 &v8, index_type &p, op_type &op)
constructor
for_each_prop2(S1 &v1, S2 &v2, index_type &p, op_type &op)
constructor
for_each_prop1(vector_type &v, index_type &p, op_type &op)
constructor
void operator()(T &t) const
It call the copy function for each property.
for_each_prop4(S1 &v1, S2 &v2, S3 &v3, S4 &v4, index_type &p, op_type &op)
constructor