8#ifndef OPENFPM_NUMERICS_SRC_OPERATORS_VECTOR_VECTOR_DIST_OPERATORS_HPP_
9#define OPENFPM_NUMERICS_SRC_OPERATORS_VECTOR_VECTOR_DIST_OPERATORS_HPP_
11#include "Vector/vector_dist.hpp"
12#include "Vector/vector_dist_subset.hpp"
13#include "lib/pdata.hpp"
14#include "cuda/vector_dist_operators_cuda.cuh"
16#define PROP_CUSTOM (unsigned int)-2
23#define VECT_APPLYKER_IN 7
24#define VECT_APPLYKER_OUT 8
25#define VECT_APPLYKER_REDUCE 9
26#define VECT_APPLYKER_IN_GEN 10
27#define VECT_APPLYKER_OUT_GEN 11
28#define VECT_APPLYKER_REDUCE_GEN 12
29#define VECT_APPLYKER_IN_SIM 13
30#define VECT_APPLYKER_OUT_SIM 14
31#define VECT_APPLYKER_REDUCE_SIM 15
33#define VECT_APPLYKER_IN_GEN_SORT 16
34#define VECT_APPLYKER_IN_SORT 17
35#define VECT_APPLYKER_IN_SIM_SORT 18
69#define VECT_NEARBYINT 89
72#define VECT_SUB_UNI 92
73#define VECT_SUM_REDUCE 93
75#define VECT_NORM_INF 95
79#define VECT_DCPSE_V 101
80#define VECT_DCPSE_V_SUM 102
81#define VECT_DCPSE_V_DOT 103
82#define VECT_DCPSE_V_DIV 104
83#define VECT_DCPSE_V_CURL2D 105
84#define VECT_COPY_1_TO_N 300
85#define VECT_COPY_N_TO_N 301
86#define VECT_COPY_N_TO_1 302
88#define VECT_SUB_UNI 92
93template<
bool cond,
typename exp1,
typename exp2>
96 typedef typename exp2::vtype vtype;
98 static auto getVector(
const exp1 & o1,
const exp2 & o2) ->
decltype(o2.getVector())
100 return o2.getVector();
104template<
typename exp1,
typename exp2>
107 typedef typename exp1::vtype vtype;
109 static auto getVector(
const exp1 & o1,
const exp2 & o2) ->
decltype(o1.getVector())
111 return o1.getVector();
115template<
typename T,
typename Sfinae =
void>
143template<
typename ObjType,
typename Sfinae =
void>
146template<
typename ObjType>
155template <typename T, bool has_init = has_init<T>::value >
159 static inline void call(T & r_exp)
174 static inline void call(T & r_exp)
187template <
typename exp1,
typename exp2,
unsigned int op>
193template<
typename v1_type,
typename v2_type>
196 typedef v1_type type;
198 template<
typename exp1,
typename exp2>
199 static const type & getVector(
const exp1 & o1,
const exp2 & o2)
201 return o1.getVector();
204 template<
typename exp1>
205 static const type & getVector(
const exp1 & o1)
207 return o1.getVector();
212template<
typename v2_type>
215 typedef v2_type type;
217 template<
typename exp1,
typename exp2>
218 static const type & getVector(
const exp1 & o1,
const exp2 & o2)
220 return o2.getVector();
223 template<
typename exp2>
224 static const type & getVector(exp2 & o2)
226 return o2.getVector();
230template<
typename NN1_type,
typename NN2_type>
233 typedef NN1_type type;
235 template<
typename exp1,
typename exp2>
236 static type * getNN(exp1 & o1, exp2 & o2)
241 template<
typename exp1>
242 static type * getNN(exp1 & o1)
249template<
typename NN2_type>
252 typedef NN2_type type;
254 template<
typename exp1,
typename exp2>
255 static type * getNN(exp1 & o1, exp2 & o2)
260 template<
typename exp2>
261 static type * getNN(exp2 & o2)
267template<
bool s1,
bool s2>
270 typedef boost::mpl::bool_<s1 | s2> type;
279template <
typename exp1,
typename exp2>
297 typedef typename vector_is_sort_result<exp1::is_sort::value,exp2::is_sort::value>::type
is_sort;
300 typedef typename nn_type_result<typename exp1::NN_type,typename exp2::NN_type>::type
NN_type;
338 return o1.value(key) + o2.value(key);
341 template<
typename Sys_eqs,
typename pmap_type,
typename unordered_map_type,
typename coeff_type>
342 inline void value_nz(pmap_type & p_map,
const vect_dist_key_dx & key, unordered_map_type & cols, coeff_type & coeff,
unsigned int comp)
const
344 o1.template value_nz<Sys_eqs>(p_map,key,cols,coeff, comp);
345 o2.template value_nz<Sys_eqs>(p_map,key,cols,coeff, comp);
379 template<
typename r_type=
typename std::remove_reference<
decltype(o1.value(0) + o2.value(0))>::type >
380 __device__ __host__
inline r_type
value(
const unsigned int & key)
const
382 return o1.value(key) + o2.value(key);
393template <
typename exp1,
typename exp2>
407 typedef typename exp1::is_ker is_ker;
410 typedef typename vector_is_sort_result<exp1::is_sort::value,exp2::is_sort::value>::type
is_sort;
413 typedef typename nn_type_result<typename exp1::NN_type,typename exp2::NN_type>::type
NN_type;
452 return o1.value(key) - o2.value(key);
463 __device__ __host__
inline r_type
value(
const unsigned int & key)
const
465 return o1.value(key) - o2.value(key);
492 template<
typename Sys_eqs,
typename pmap_type,
typename unordered_map_type,
typename coeff_type>
493 inline void value_nz(pmap_type & p_map,
const vect_dist_key_dx & key, unordered_map_type & cols, coeff_type & coeff,
unsigned int comp)
const
495 o1.template value_nz<Sys_eqs>(p_map,key,cols,coeff,comp);
496 coeff_type tmp = -coeff;
497 o2.template value_nz<Sys_eqs>(p_map,key,cols,tmp,comp);
507template <
typename exp1,
typename exp2>
521 typedef typename exp1::is_ker is_ker;
524 typedef typename vector_is_sort_result<exp1::is_sort::value,exp2::is_sort::value>::type
is_sort;
527 typedef typename nn_type_result<typename exp1::NN_type,typename exp2::NN_type>::type
NN_type;
555 return o1.value(key) * o2.value(key);
558 template<
typename Sys_eqs,
typename pmap_type,
typename unordered_map_type,
typename coeff_type>
559 inline void value_nz(pmap_type & p_map,
const vect_dist_key_dx & key, unordered_map_type & cols, coeff_type & coeff,
unsigned int comp)
const
562 auto coeff_tmp = o1.value(key) * coeff;
563 o2.template value_nz<Sys_eqs>(p_map,key,cols,coeff_tmp,comp);
598 __device__ __host__
inline r_type
value(
const unsigned int & key)
const
600 return o1.value(key) * o2.value(key);
610template <
typename exp1,
typename exp2>
624 typedef typename exp1::is_ker is_ker;
627 typedef typename vector_is_sort_result<exp1::is_sort::value,exp2::is_sort::value>::type
is_sort;
630 typedef typename nn_type_result<typename exp1::NN_type,typename exp2::NN_type>::type
NN_type;
668 return o1.value(key) / o2.value(key);
671 template<
typename Sys_eqs,
typename pmap_type,
typename unordered_map_type,
typename coeff_type>
672 inline void value_nz(pmap_type & p_map,
const vect_dist_key_dx & key, unordered_map_type & cols, coeff_type & coeff,
unsigned int comp)
const
674 std::cout << __FILE__ <<
":" << __LINE__ <<
" You are trying to divide by an operator, this is not possible " << std::endl;
709 __device__ __host__
inline r_type
value(
const unsigned int & key)
const
711 return o1.value(key) / o2.value(key);
720template <
typename exp1>
729 typedef typename exp1::is_ker is_ker;
732 typedef typename vector_result<typename exp1::vtype,void>::type
vtype;
735 typedef typename vector_is_sort_result<exp1::is_sort::value,false>::type
is_sort;
738 typedef typename nn_type_result<typename exp1::NN_type,void>::type
NN_type;
780 return o1.getVector();
785 template<
typename r_type=
typename std::remove_reference<
decltype(-(o1.value(
vect_dist_key_dx(0))))>::type >
788 return -(o1.value(key));
791 template<
typename Sys_eqs,
typename pmap_type,
typename unordered_map_type,
typename coeff_type>
792 inline void value_nz(pmap_type & p_map,
const vect_dist_key_dx & key, unordered_map_type & cols, coeff_type & coeff,
unsigned int comp)
const
794 coeff_type coeff_tmp = -coeff;
795 o1.template value_nz<Sys_eqs>(p_map,key,cols,coeff_tmp, comp);
798 template<
typename r_type=
typename std::remove_reference<
decltype(-(o1.value(
vect_dist_key_dx(0))))>::type >
799 __device__ __host__
inline r_type
value(
const unsigned int & key)
const
801 return -(o1.value(key));
809template<
int impl,
bool vect_ker>
812 typedef boost::mpl::int_<impl> type;
818 typedef boost::mpl::int_<-1> type;
824 typedef boost::mpl::int_<-1> type;
833 template<
bool cond_,
typename v_type,
typename exp_type>
834 static void compute(v_type &v,exp_type &v_exp)
836 ::compute_expr(v,v_exp);}
839template<
unsigned int prp,
typename vector>
842template<
typename v_exp>
846 static auto transform(T & v) ->
decltype(v)
855 template<
typename T_>
856 static auto transform(T_ & v) ->
decltype(v.getVector().toKernel())
858 return v.getVector().toKernel();
866 template<
bool cond,
typename v_type,
typename exp_type>
867 static void compute(v_type &v, exp_type &v_exp)
868 {
auto v_ker=v.toKernel();
871 ::compute_expr(v_ker,v_exp_transformed);}
874template<typename vector, bool is_ker = has_vector_kernel<vector>::type::value>
877 typedef vector& type;
880template<
typename vector>
886template<
typename vector>
904template<
unsigned int prp,
typename vector>
926 static const unsigned int prop = prp;
930 void setVarId(
int var_id)
932 this->var_id = var_id;
1050 return this->
value(key);
1062 if (v_exp.
getVector().isSubset() ==
true)
1064 std::cout << __FILE__ <<
":" << __LINE__ <<
" error on the right hand side of the expression you have to use non-subset properties" << std::endl;
1072 ::compute_expr(
v.v,v_exp);
1078 ::compute_expr(
v.v,v_exp);
1097 ::compute_expr(
v.v,v_exp);
1114 ::compute_expr(
v.v,v_exp.getVector().toKernel());
1129 template<
typename exp1,
typename exp2,
unsigned int op>
1132 if (v_exp.getVector().isSubset() ==
true)
1134 std::cout << __FILE__ <<
":" << __LINE__ <<
" error on the right hand side of the expression you have to use non-subset properties" << std::endl;
1144 ::compute_expr(
v.v,v_exp);
1152 ::compute_expr(
v.v,v_exp);
1173 ::compute_const(
v.v,d);
1181 ::compute_const(
v.v,d);
1188 template<
typename Sys_eqs,
typename pmap_type,
typename unordered_map_type,
typename coeff_type>
1189 inline void value_nz(pmap_type & p_map,
const vect_dist_key_dx & key, unordered_map_type & cols, coeff_type & coeff,
unsigned int comp)
const
1191 cols[p_map.
template getProp<0>(key)*Sys_eqs::nvar + var_id + comp] += coeff;
1212template<
typename vector_type>
1217 typedef typename boost::mpl::at<typename vector_type::value_type::type,boost::mpl::int_<0>>::type T;
1223 typedef T * iterator;
1224 typedef const T * const_iterator;
1241 static const unsigned int prop = 0;
1245 void setVarId(
int var_id)
1247 this->var_id = var_id;
1252 {
return &
v.template get<0>(0); }
1254 const_iterator begin()
const
1255 {
return &
v.template get<0>(0); }
1258 {
return &
v.template get<0>(
v.size()-1)+1; }
1260 const_iterator end()
const
1261 {
return &
v.template get<0>(
v.size()-1)+1; }
1264 {
return v.size(); }
1266 void resize(
size_t n)
1295 template<
unsigned int prp2,
typename vector2>
1301 template<
typename exp1,
typename exp2,
unsigned int op>
1358 return v.template get<0>(k.getKey());
1373 std::cout << __FILE__ <<
":" << __LINE__ <<
" error on the right hand side of the expression you have to use non-subset properties" << std::endl;
1389 ::compute_expr(
v,v_exp);
1407 template<
typename exp1,
typename exp2,
unsigned int op>
1410 if (v_exp.getVector().isSubset() ==
true)
1412 std::cout << __FILE__ <<
":" << __LINE__ <<
" error on the right hand side of the expression you have to use non-subset properties" << std::endl;
1416 v.
resize(v_exp.getVector().size_local());
1424 ::compute_expr(
v,v_exp);
1432 ::compute_expr(
v,v_exp);
1447 std::cout << __FILE__ <<
":" << __LINE__ <<
" Error: temporal with constants is unsupported" << std::endl;
1451 template<
typename Sys_eqs,
typename pmap_type,
typename unordered_map_type,
typename coeff_type>
1452 inline void value_nz(pmap_type & p_map,
const vect_dist_key_dx & key, unordered_map_type & cols, coeff_type & coeff,
unsigned int comp)
const
1454 std::cout << __FILE__ <<
":" << __LINE__ <<
" Error: use of temporal is not supported to construct equations";
1475template<
typename T,
typename memory,
template <
typename>
class layout_base >
1486 template<
unsigned int prp2,
typename vector2>
1492 template<
typename exp1,
typename exp2,
unsigned int op>
1500 return base::operator=(v_exp);
1502 template<
typename exp1,
typename exp2,
unsigned int op>
1505 return base::operator=(v_exp);
1525 template<
unsigned int prp2,
typename vector2>
1531 template<
typename exp1,
typename exp2,
unsigned int op>
1539 return base::operator=(v_exp);
1544 return base::operator=(v_exp);
1549 return base::operator=(v_exp);
1552 template<
typename exp1,
typename exp2,
unsigned int op>
1555 return base::operator=(v_exp);
1565template<
typename vector,
unsigned int impl>
1568 typedef vector type;
1570 static vector & get(vector & v) {
return v;};
1572 template<
typename exp_type,
typename vector_klist>
1573 static void register_vector(exp_type & exp_v, vector_klist & v,
bool is_sort)
1578template<
typename vector>
1581 typedef decltype(std::declval<vector>().toKernel()) type;
1583 static type get(vector & v) {
return v.toKernel();};
1585 template<
typename exp_type,
typename vector_klist>
1586 static void register_vector(exp_type & exp_v, vector_klist & v,
bool is_sort)
1588 exp_v.set_vector_dist_ker_list(v.private_get_vector_dist_ker_list(),is_sort);
1686template <
typename exp1,
int n>
1696 void setVarId(
int var_id)
1698 this->var_id = var_id;
1705 typedef std::false_type is_ker;
1713 typedef typename exp1::vtype vtype;
1718 :o1(o1),var_id(var_id)
1720 for (
int i = 0 ; i < n ; i++)
1721 {this->comp[i] = comp[i];}
1733 return o1.getVector();
1745 return o1.getVector();
1756 typedef typename pos_or_propL<vtype,exp1::prop>::property_act
property_act;
1800 return this->value(key);
1803 template<
typename Sys_eqs,
typename pmap_type,
typename unordered_map_type,
typename coeff_type>
1804 inline void value_nz(pmap_type & p_map,
const vect_dist_key_dx & key, unordered_map_type & cols, coeff_type & coeff,
unsigned int comp_)
const
1810 std::cout << __FILE__ <<
":" << __LINE__ <<
" Error it only work for tensore of rank 1 ... like vectors " << std::endl;
1815 o1.template value_nz<Sys_eqs>(p_map,key,cols,coeff,comp_ + var_id + comp[0]);
1822 for (
int i = 0 ; i < n ; i++)
1823 {comp_n[i] = comp[i];}
1842 auto & v = getVector();
1849 auto it = v.getDomainIterator();
1853 auto key = it.get();
1854 auto key_orig = v.getOriginKey(key);
1875 auto & v = getVector();
1879 SubsetSelector_impl<std::remove_reference<
decltype(v)>::type::is_it_a_subset::value>::check(v2,v);
1881 auto it = v.getDomainIterator();
1885 auto key = it.get();
1886 auto key_orig = v.getOriginKey(key);
1905 if (v_exp.getVector().isSubset() ==
true)
1907 std::cout << __FILE__ <<
":" << __LINE__ <<
" error on the right hand side of the expression you have to use non-subset properties" << std::endl;
1908 return this->getVector();
1915 ::compute_expr_slice(o1.getVector(),v_exp,comp);
1921 ::compute_expr_slice(o1.getVector(),v_exp,comp);
1924 return this->getVector();
1936 auto & v = getVector();
1938 auto it = v.getDomainIterator();
1942 auto key = it.get();
1961template <
unsigned int prp,
unsigned int impl = comp_host,
typename vector>
1979template <
unsigned int prp,
typename vector>
1982 auto vk = v.toKernel_sorted();
1985 exp_v.set_vector_dist_ker_list(v.private_get_vector_dist_ker_list(),
true);
1995template<
unsigned int prp>
2003 typedef std::false_type is_ker;
2038 template<
typename Sys_eqs,
typename pmap_type,
typename unordered_map_type,
typename coeff_type>
2039 inline void value_nz(pmap_type & p_map,
const vect_dist_key_dx & key, unordered_map_type & cols, coeff_type & coeff,
unsigned int comp)
const
2041 cols[p_map.
template getProp<0>(key)*Sys_eqs::nvar + comp] += coeff;
2052 __host__ __device__
inline double value(
const unsigned int & k)
const
2064template<
unsigned int prp>
2072 typedef std::false_type is_ker;
2078 typedef void NN_type;
2116 __device__ __host__
inline float value(
const unsigned int & k)
const
2130template<
unsigned int p1,
unsigned int p2,
typename v1,
typename v2>
2147template<
typename exp1 ,
typename exp2,
unsigned int op1,
unsigned int prp1,
typename v1>
2164template<
typename exp1 ,
typename exp2,
unsigned int op1,
unsigned int prp1,
typename v1>
2181template<
typename exp1 ,
typename exp2,
unsigned int op1,
typename exp3 ,
typename exp4,
unsigned int op2>
2198template<
unsigned int prp1 ,
typename v1>
2215template<typename T, unsigned int prp1, typename v1, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2232template<
unsigned int prp1 ,
typename v1>
2249template<
unsigned int prp1 ,
typename v1>
2266template<
typename exp1 ,
typename exp2,
unsigned int op1>
2283template<typename T, typename exp1 , typename exp2, unsigned int op1, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2300template<
unsigned int p1,
unsigned int p2,
typename v1,
typename v2>
2318template<
typename exp1,
typename exp2,
unsigned int op1,
unsigned int p2,
typename v2>
2334template<
typename exp1,
typename exp2_,
unsigned int op1>
2350template<
unsigned int p1,
typename v1>
2368template<
typename exp1,
typename exp2,
unsigned int op1,
unsigned int p2,
typename v2>
2385template<
typename exp1,
typename exp2,
unsigned int op1,
typename exp3,
typename exp4,
unsigned int op2>
2402template<
unsigned int prp1,
typename v1>
2420template<typename T, unsigned int prp1,typename v1, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2437template<
unsigned int prp1,
typename v1>
2454template<typename T, unsigned int prp1,typename v1, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2471template<
unsigned int p2,
typename v2>
2488template<typename T, unsigned int p2,typename v2, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2505template<
unsigned int p2,
typename v2>
2522template<typename T, unsigned int p2,typename v2, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2539template<
unsigned int p1,
typename v1,
unsigned int p2,
typename v2>
2556template<
unsigned int p1,
typename v1,
typename exp1,
typename exp2,
unsigned int op1>
2573template<
unsigned int p1,
typename v1,
typename exp1,
typename exp2,
unsigned int op1>
2590template<
typename exp1,
typename exp2,
unsigned int op1,
typename exp3 ,
typename exp4,
unsigned int op2>
2607template<
typename exp1 ,
typename exp2,
unsigned int op1>
2624template<typename T, typename exp1 , typename exp2, unsigned int op1, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2641template<
typename exp1 ,
typename exp2,
unsigned int op1>
2658template<typename T, typename exp1 , typename exp2, unsigned int op1, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2675template<
typename exp1,
typename exp2,
unsigned int op1>
2692template<typename T, typename exp1 , typename exp2, unsigned int op1, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2709template<
typename exp1,
typename exp2,
unsigned int op1>
2726template<typename T, typename exp1 , typename exp2, unsigned int op1, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2743template<
unsigned int prp1,
typename v1>
2760template<typename T, unsigned int prp1,typename v1, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2777template<
unsigned int prp1,
typename v1>
2794template<typename T, unsigned int prp1,typename v1, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2811template<
unsigned int prp1,
typename v1,
unsigned int prp2,
typename v2>
2828template<
unsigned int prp1,
typename v1,
typename exp1,
typename exp2,
unsigned int op1>
2845template<
unsigned int prp1,
typename v1,
typename exp1,
typename exp2,
unsigned int op1>
2862template<
typename exp1,
typename exp2,
unsigned int op1,
typename exp3,
typename exp4,
unsigned int op2>
2871#include "vector_dist_operators_apply_kernel.hpp"
2872#include "vector_dist_operators_functions.hpp"
2873#include "vector_dist_operators_extensions.hpp"
2874#include "Operators/Vector/vector_dist_operator_assign.hpp"
Implementation of 1-D std::vector like structure.
Grid key for a distributed grid.
Sub class that encapsulate a GPU vector properties operand to be used for expressions construction Te...
boost::mpl::bool_< false > is_sort
result for is sort
__device__ __host__ double value(const vect_dist_key_dx &k) const
Evaluate the expression.
vector_dist_expression(const double &d)
constructor from a constant expression
double d
constant parameter
__host__ __device__ double value(const unsigned int &k) const
Evaluate the expression.
void init() const
This function must be called before value.
vector_dist_expression(const float &d)
constrictor from constant value
boost::mpl::bool_< false > is_sort
result for is sort
__device__ __host__ float value(const unsigned int &k) const
Evaluate the expression.
void init() const
This function must be called before value.
float value(const vect_dist_key_dx &k) const
Evaluate the expression.
Main class that encapsulate a vector properties operand to be used for expressions construction Tempo...
vector_type vector
Internal vector.
vector & operator=(const vector_dist_expression_op< exp1, exp2, op > &v_exp)
Fill the vector property with the evaluated expression.
T value_type
The type of the internal value.
vector & operator=(const vector_dist_expression< prp2, vector2 > &v_exp)
Fill the vector property with the evaluated expression.
vector & operator=(double d)
Fill the vector property with the double.
vector vtype
The type of the internal vector.
void init() const
This function must be called before value.
__device__ __host__ const vector & getVector() const
Return the vector on which is acting.
vector v
The temporal vector.
__device__ __host__ vector & getVector()
Return the vector on which is acting.
__host__ __device__ auto value(const vect_dist_key_dx &k) const -> decltype(v.template get< 0 >(k.getKey()))
Evaluate the expression.
void * getNN() const
get the NN object
boost::mpl::bool_< false > is_sort
result for is sort
__device__ __host__ const vtype & getVector() const
Return the vector on which is acting.
boost::mpl::bool_< false > is_sort
result for is sort
pos_or_propL< vtype, exp1::prop >::property_act property_act
property on which this view is acting
vtype & operator=(const vector_dist_expression_op< exp1_, exp2_, op > &v_exp)
Fill the vector property with the evaluated expression.
vtype & operator=(const vector_dist_expression< prp2, vtype > &v_exp)
Fill the vector property with the evaluated expression.
auto get(const vect_dist_key_dx &key) const -> decltype(value(key))
Return the result of the expression.
void init() const
initialize the expression tree
vtype & operator=(const vector_dist_expression< 0, openfpm::vector< aggregate< T >, memory > > &v_exp)
Fill the vector property with the evaluated expression.
__device__ __host__ vtype & getVector()
Return the vector on which is acting.
vector_dist_expression_op(const exp1 &o1, int(&comp)[n], int var_id)
constructor from an expresssion
vtype & operator=(double d)
Fill the vector property with the double.
boost::mpl::bool_< false > NN_type
result for is sort
__host__ __device__ auto value(const vect_dist_key_dx &key) -> decltype(get_vector_dist_expression_op< n, n==rank_gen< property_act >::type::value >::get(o1, vect_dist_key_dx(0), comp))
Return the result of the expression.
__host__ __device__ auto value(const vect_dist_key_dx &key) const -> decltype(get_vector_dist_expression_op< n, n==rank_gen< property_act >::type::value >::get(o1, vect_dist_key_dx(0), comp))
Return the result of the expression.
const vtype & getVector()
Return the vector on which is acting.
const exp2 o2
expression 2
first_or_second< has_vtype< exp1 >::value, exp1, exp2 >::vtype vtype
The type of the internal vector.
NN_type * getNN() const
get the NN object
vector_is_sort_result< exp1::is_sort::value, exp2::is_sort::value >::type is_sort
result for is sort
void init() const
This function must be called before value.
__device__ __host__ r_type value(const unsigned int &key) const
Evaluate the expression.
const exp1 o1
expression 1
nn_type_result< typenameexp1::NN_type, typenameexp2::NN_type >::type NN_type
NN_type.
r_type value(const vect_dist_key_dx &key) const
Evaluate the expression.
vector_dist_expression_op(const exp1 &o1, const exp2 &o2)
constructor from two expressions
const vtype & getVector() const
Return the vector on which is acting.
const exp2 o2
expression 2
void init() const
This function must be called before value.
const vtype & getVector() const
Return the vector on which is acting.
nn_type_result< typenameexp1::NN_type, typenameexp2::NN_type >::type NN_type
NN_type.
vector_is_sort_result< exp1::is_sort::value, exp2::is_sort::value >::type is_sort
result for is sort
first_or_second< has_vtype< exp1 >::value, exp1, exp2 >::vtype vtype
The type of the internal vector.
const exp1 o1
expression 1
__device__ __host__ r_type value(const unsigned int &key) const
Evaluate the expression.
__device__ __host__ r_type value(const vect_dist_key_dx &key) const
Evaluate the expression.
const vtype & getVector()
Return the vector on which is acting.
vector_dist_expression_op(const exp1 &o1, const exp2 &o2)
constructor from two expressions
const exp2 o2
expression 2
const vtype & getVector() const
Return the vector on which is acting.
void init() const
This function must be called before value.
const vtype & getVector()
Return the vector on which is acting.
vector_dist_expression_op(const exp1 &o1, const exp2 &o2)
Costruct a subtraction expression out of two expressions.
__device__ __host__ r_type value(const unsigned int &key) const
Evaluate the expression.
const exp1 o1
expression 1
vector_is_sort_result< exp1::is_sort::value, exp2::is_sort::value >::type is_sort
result for is sort
first_or_second< has_vtype< exp1 >::value, exp1, exp2 >::vtype vtype
The type of the internal vector.
r_type value(const vect_dist_key_dx &key) const
Evaluate the expression.
nn_type_result< typenameexp1::NN_type, typenameexp2::NN_type >::type NN_type
NN_type.
NN_type * getNN() const
get the NN object
const exp1 o1
expression 1
NN_type * getNN() const
get the NN object
__device__ __host__ r_type value(const unsigned int &key) const
Evaluate the expression.
exp1::is_ker is_ker
indicate if this vector is kernel type
const vtype & getVector()
Return the vector on which is acting.
const vtype & getVector() const
Return the vector on which is acting.
first_or_second< has_vtype< exp1 >::value, exp1, exp2 >::vtype vtype
return the vector type on which this expression operate
vector_dist_expression_op(const exp1 &o1, const exp2 &o2)
constructor of the expression to sum two expression
__device__ __host__ r_type value(const vect_dist_key_dx &key) const
Evaluate the expression.
void init() const
This function must be called before value.
const exp2 o2
expression 2
vector_is_sort_result< exp1::is_sort::value, exp2::is_sort::value >::type is_sort
result for is sort
nn_type_result< typenameexp1::NN_type, typenameexp2::NN_type >::type NN_type
NN_type.
const vtype & getVector() const
Return the vector on which is acting.
const exp1 o1
expression 1
vector_dist_expression_op(const exp1 &o1)
constructor from an expresssion
vector_is_sort_result< exp1::is_sort::value, false >::type is_sort
result for is sort
NN_type * getNN() const
get the NN object
const vtype & getVector()
Return the underlying vector.
vector_result< typenameexp1::vtype, void >::type vtype
return the vector type on which this expression operate
nn_type_result< typenameexp1::NN_type, void >::type NN_type
NN_type.
__device__ __host__ r_type value(const unsigned int &key) const
return the result of the expression
void init() const
initialize the expression tree
__device__ __host__ r_type value(const vect_dist_key_dx &key) const
return the result of the expression
Unknown operation specialization.
Main class that encapsulate a vector properties operand to be used for expressions construction.
boost::mpl::bool_< false > is_sort
result for is sort
v_mem_mutable< typename vector_expression_transform< vector >::type > v
The vector.
void * getNN() const
get the NN object
void set_vector_dist_ker_list(vector_dist_ker_list< vector > &vdkl, bool is_sort)
set vector_dist_ker_list
vector & operator=(const vector_dist_expression< prp2, vector > &v_exp)
Fill the vector property with the evaluated expression.
vector & operator=(const vector_dist_expression_op< exp1, exp2, op > &v_exp)
Fill the vector property with the evaluated expression.
~vector_dist_expression()
constructor for an external vector
__host__ __device__ auto value(const vect_dist_key_dx &k) const -> decltype(pos_or_propR< vector, prp >::value(v.v, k))
Evaluate the expression.
__host__ __device__ auto value(const vect_dist_key_dx &k) -> decltype(pos_or_propR< vector, prp >::value(v.v, k))
Evaluate the expression.
vector & operator=(const vector_dist_expression< 0, openfpm::vector_gpu< aggregate< T > > > &v_exp)
Fill the vector property with the evaluated expression.
vector & operator=(const vector_dist_expression< 0, openfpm::vector< aggregate< T >, memory, layout_base > > &v_exp)
Fill the vector property with the evaluated expression.
vector & operator=(double d)
Fill the vector property with the double.
__host__ __device__ auto value(const unsigned int &k) -> decltype(pos_or_propR< vector, prp >::value(v.v, k))
Evaluate the expression.
__device__ __host__ const vector & getVector() const
Return the vector on which is acting.
__device__ __host__ vector & getVector()
Return the vector on which is acting.
vector vtype
The type of the internal vector.
__host__ __device__ auto value(const unsigned int &k) const -> decltype(pos_or_propR< vector, prp >::value(v.v, k))
Evaluate the expression.
vector_dist_expression(vector &v)
constructor for an external vector
void init() const
This function must be called before value.
This class contain a list of all tracked vector_dist_ker around.
void remove(vector_dist_ker_type &v)
Remove one vector_dist_kernels entry.
void add(vector_dist_ker_type &v, bool is_sorted)
Add a new vector_dist_kernel to track.
size_t size_local() const
return the local size of the vector
void resize(size_t rs)
Resize the vector (locally)
bool isSubset() const
Indicate that this class is not a subset.
convert a type into constant type
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...
static void call(T &r_exp)
it call the function init for r_exp if T has the function init
Call the init function if a type T has the function init.
static void call(T &r_exp)
it call the function init for r_exp if T has the function init
has_init check if a type has defined a method called init
Transform the boost::fusion::vector into memory specification (memory_traits)
__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
Expression implementation computation selector.
Expression implementation computation selector.