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
59 #define VECT_TGAMMA 83
60 #define VECT_LGAMMA 84
65 #define VECT_NEARBYINT 89
68 #define VECT_SUB_UNI 92
69 #define VECT_SUM_REDUCE 93
71 #define VECT_NORM_INF 95
74 #define VECT_DCPSE 100
75 #define VECT_DCPSE_V 101
76 #define VECT_DCPSE_V_SUM 102
77 #define VECT_DCPSE_V_DOT 103
78 #define VECT_DCPSE_V_DIV 104
79 #define VECT_DCPSE_V_CURL2D 105
80 #define VECT_COPY_1_TO_N 300
81 #define VECT_COPY_N_TO_N 301
82 #define VECT_COPY_N_TO_1 302
84 #define VECT_SUB_UNI 92
89 template<
bool cond,
typename exp1,
typename exp2>
92 typedef typename exp2::vtype vtype;
94 static auto getVector(
const exp1 & o1,
const exp2 & o2) -> decltype(o2.getVector())
96 return o2.getVector();
100 template<
typename exp1,
typename exp2>
103 typedef typename exp1::vtype vtype;
105 static auto getVector(
const exp1 & o1,
const exp2 & o2) -> decltype(o1.getVector())
107 return o1.getVector();
111 template<
typename T,
typename Sfinae =
void>
124 struct has_vtype<T, typename
Void<typename T::vtype>::type> : std::true_type
139 template<
typename ObjType,
typename Sfinae =
void>
142 template<
typename ObjType>
151 template <typename T, bool has_init = has_init<T>::value >
155 static inline void call(T & r_exp)
166 template <
typename T>
170 static inline void call(T & r_exp)
183 template <
typename exp1,
typename exp2,
unsigned int op>
189 template<
typename v1_type,
typename v2_type>
192 typedef v1_type type;
194 template<
typename exp1,
typename exp2>
195 static const type & getVector(
const exp1 & o1,
const exp2 & o2)
197 return o1.getVector();
200 template<
typename exp1>
201 static const type & getVector(
const exp1 & o1)
203 return o1.getVector();
208 template<
typename v2_type>
211 typedef v2_type type;
213 template<
typename exp1,
typename exp2>
214 static const type & getVector(
const exp1 & o1,
const exp2 & o2)
216 return o2.getVector();
219 template<
typename exp2>
220 static const type & getVector(exp2 & o2)
222 return o2.getVector();
226 template<
typename NN1_type,
typename NN2_type>
229 typedef NN1_type type;
231 template<
typename exp1,
typename exp2>
232 static type * getNN(exp1 & o1, exp2 & o2)
237 template<
typename exp1>
238 static type * getNN(exp1 & o1)
245 template<
typename NN2_type>
248 typedef NN2_type type;
250 template<
typename exp1,
typename exp2>
251 static type * getNN(exp1 & o1, exp2 & o2)
256 template<
typename exp2>
257 static type * getNN(exp2 & o2)
270 template <
typename exp1,
typename exp2>
288 typedef typename nn_type_result<typename exp1::NN_type,typename exp2::NN_type>::type
NN_type;
326 return o1.value(key) + o2.value(key);
329 template<
typename Sys_eqs,
typename pmap_type,
typename unordered_map_type,
typename coeff_type>
330 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
332 o1.template value_nz<Sys_eqs>(p_map,key,cols,coeff, comp);
333 o2.template value_nz<Sys_eqs>(p_map,key,cols,coeff, comp);
367 template<
typename r_type=
typename std::remove_reference<decltype(o1.value(0) + o2.value(0))>::type >
368 __device__ __host__
inline r_type
value(
const unsigned int & key)
const
370 return o1.value(key) + o2.value(key);
381 template <
typename exp1,
typename exp2>
395 typedef typename exp1::is_ker is_ker;
398 typedef typename nn_type_result<typename exp1::NN_type,typename exp2::NN_type>::type
NN_type;
437 return o1.value(key) - o2.value(key);
448 __device__ __host__
inline r_type
value(
const unsigned int & key)
const
450 return o1.value(key) - o2.value(key);
478 template<
typename Sys_eqs,
typename pmap_type,
typename unordered_map_type,
typename coeff_type>
479 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
481 o1.template value_nz<Sys_eqs>(p_map,key,cols,coeff,comp);
482 coeff_type tmp = -coeff;
483 o2.template value_nz<Sys_eqs>(p_map,key,cols,tmp,comp);
493 template <
typename exp1,
typename exp2>
507 typedef typename exp1::is_ker is_ker;
510 typedef typename nn_type_result<typename exp1::NN_type,typename exp2::NN_type>::type
NN_type;
538 return o1.value(key) * o2.value(key);
541 template<
typename Sys_eqs,
typename pmap_type,
typename unordered_map_type,
typename coeff_type>
542 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
545 auto coeff_tmp = o1.value(key) * coeff;
546 o2.template value_nz<Sys_eqs>(p_map,key,cols,coeff_tmp,comp);
581 __device__ __host__
inline r_type
value(
const unsigned int & key)
const
583 return o1.value(key) * o2.value(key);
593 template <
typename exp1,
typename exp2>
607 typedef typename exp1::is_ker is_ker;
610 typedef typename nn_type_result<typename exp1::NN_type,typename exp2::NN_type>::type
NN_type;
648 return o1.value(key) / o2.value(key);
651 template<
typename Sys_eqs,
typename pmap_type,
typename unordered_map_type,
typename coeff_type>
652 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
654 std::cout << __FILE__ <<
":" << __LINE__ <<
" You are trying to divide by an operator, this is not possible " << std::endl;
689 __device__ __host__
inline r_type
value(
const unsigned int & key)
const
691 return o1.value(key) / o2.value(key);
700 template <
typename exp1>
709 typedef typename exp1::is_ker is_ker;
712 typedef typename vector_result<typename exp1::vtype,void>::type
vtype;
715 typedef typename nn_type_result<typename exp1::NN_type,void>::type
NN_type;
757 return o1.getVector();
762 template<
typename r_type=
typename std::remove_reference<decltype(-(o1.value(
vect_dist_key_dx(0))))>::type >
765 return -(o1.value(key));
768 template<
typename Sys_eqs,
typename pmap_type,
typename unordered_map_type,
typename coeff_type>
769 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
771 coeff_type coeff_tmp = -coeff;
772 o1.template value_nz<Sys_eqs>(p_map,key,cols,coeff_tmp, comp);
775 template<
typename r_type=
typename std::remove_reference<decltype(-(o1.value(
vect_dist_key_dx(0))))>::type >
776 __device__ __host__
inline r_type
value(
const unsigned int & key)
const
778 return -(o1.value(key));
786 template<
int impl,
bool vect_ker>
789 typedef boost::mpl::int_<impl> type;
795 typedef boost::mpl::int_<-1> type;
801 typedef boost::mpl::int_<-1> type;
807 template<
bool cond,
unsigned int prop = 0>
810 template<
bool cond_,
typename v_type,
typename exp_type>
811 static void compute(v_type &v,exp_type &v_exp)
813 ::compute_expr(v,v_exp);}
815 template<
bool cond_,
unsigned int n,
typename v_type,
typename exp_type>
816 static void compute(v_type &v,exp_type &v_exp,
int (& comp)[n])
818 ::compute_expr_slice(v,v_exp,comp);}
821 template<
unsigned int prp,
typename vector>
824 template<
typename v_exp>
828 static auto transform(T & v) -> decltype(v)
837 template<
typename T_>
838 static auto transform(T_ & v) -> decltype(v.getVector().toKernel())
840 return v.getVector().toKernel();
848 template<
bool cond,
typename v_type,
typename exp_type>
849 static void compute(v_type &v, exp_type &v_exp)
850 {
auto v_ker=v.toKernel();
853 ::compute_expr(v_ker,v_exp_transformed);
856 template<
bool cond,
unsigned int n,
typename v_type,
typename exp_type>
857 static void compute(v_type &v, exp_type &v_exp,
int (& comp)[n])
858 {
auto v_ker=v.toKernel();
861 ::compute_expr_slice(v_ker,v_exp_transformed, comp);
866 template<typename vector, bool is_ker = has_vector_kernel<vector>::type::value>
869 typedef vector& type;
872 template<
typename vector>
878 template<
typename vector>
896 template<
unsigned int prp,
typename vector>
915 static const unsigned int prop = prp;
919 void setVarId(
int var_id)
921 this->var_id = var_id;
1039 return this->
value(key);
1051 if (v_exp.
getVector().isSubset() ==
true)
1053 std::cout << __FILE__ <<
":" << __LINE__ <<
" error on the right hand side of the expression you have to use non-subset properties" << std::endl;
1061 ::compute_expr(
v.v,v_exp);
1067 ::compute_expr(
v.v,v_exp);
1084 ::compute_expr(
v.v,v_exp);
1101 ::compute_expr(
v.v,v_exp.getVector().toKernel());
1113 template<
typename exp1,
typename exp2,
unsigned int op>
1116 if (v_exp.getVector().isSubset() ==
true)
1118 std::cout << __FILE__ <<
":" << __LINE__ <<
" error on the right hand side of the expression you have to use non-subset properties" << std::endl;
1126 ::compute_expr(
v.v,v_exp);
1132 ::compute_expr(
v.v,v_exp);
1151 ::compute_const(
v.v,d);
1157 ::compute_const(
v.v,d);
1164 template<
typename Sys_eqs,
typename pmap_type,
typename unordered_map_type,
typename coeff_type>
1165 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
1167 cols[p_map.
template getProp<0>(key)*Sys_eqs::nvar + var_id + comp] += coeff;
1188 template<
typename vector_type>
1193 typedef typename boost::mpl::at<typename vector_type::value_type::type,boost::mpl::int_<0>>::type T;
1199 typedef T * iterator;
1200 typedef const T * const_iterator;
1214 static const unsigned int prop = 0;
1218 void setVarId(
int var_id)
1220 this->var_id = var_id;
1227 return &
v.template get<0>(0);
1232 const_iterator begin()
const
1235 return &
v.template get<0>(0);
1243 return &
v.template get<0>(
v.size()-1)+1;
1248 const_iterator end()
const
1251 return &
v.template get<0>(
v.size()-1)+1;
1257 {
return v.size(); }
1259 void resize(
size_t n)
1288 template<
unsigned int prp2,
typename vector2>
1294 template<
typename exp1,
typename exp2,
unsigned int op>
1351 return v.template get<0>(k.getKey());
1366 std::cout << __FILE__ <<
":" << __LINE__ <<
" error on the right hand side of the expression you have to use non-subset properties" << std::endl;
1376 ::compute_expr(
v,v_exp);
1394 template<
typename exp1,
typename exp2,
unsigned int op>
1397 if (v_exp.getVector().isSubset() ==
true)
1399 std::cout << __FILE__ <<
":" << __LINE__ <<
" error on the right hand side of the expression you have to use non-subset properties" << std::endl;
1403 v.
resize(v_exp.getVector().size_local());
1428 std::cout << __FILE__ <<
":" << __LINE__ <<
" Error: temporal with constants is unsupported" << std::endl;
1432 template<
typename Sys_eqs,
typename pmap_type,
typename unordered_map_type,
typename coeff_type>
1433 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
1435 std::cout << __FILE__ <<
":" << __LINE__ <<
" Error: use of temporal is not supported to construct equations";
1456 template<
typename T,
typename memory,
template <
typename>
class layout_base >
1467 template<
unsigned int prp2,
typename vector2>
1473 template<
typename exp1,
typename exp2,
unsigned int op>
1481 return base::operator=(v_exp);
1483 template<
typename exp1,
typename exp2,
unsigned int op>
1486 return base::operator=(v_exp);
1496 template<
typename T>
1506 template<
unsigned int prp2,
typename vector2>
1512 template<
typename exp1,
typename exp2,
unsigned int op>
1520 return base::operator=(v_exp);
1525 return base::operator=(v_exp);
1530 return base::operator=(v_exp);
1533 template<
typename exp1,
typename exp2,
unsigned int op>
1536 return base::operator=(v_exp);
1546 template<
typename vector,
unsigned int impl>
1549 typedef vector type;
1551 static vector & get(vector & v) {
return v;};
1553 template<
typename exp_type,
typename vector_klist>
1554 static void register_vector(exp_type & exp_v, vector_klist & v)
1559 template<
typename vector>
1562 typedef decltype(std::declval<vector>().toKernel()) type;
1564 static type get(vector & v) {
return v.toKernel();};
1566 template<
typename exp_type,
typename vector_klist>
1567 static void register_vector(exp_type & exp_v, vector_klist & v)
1569 exp_v.set_vector_dist_ker_list(v.private_get_vector_dist_ker_list());
1667 template <
typename exp1,
int n>
1677 void setVarId(
int var_id)
1679 this->var_id = var_id;
1686 typedef std::false_type is_ker;
1688 typedef boost::mpl::bool_<false> NN_type;
1690 typedef typename exp1::vtype vtype;
1691 typedef typename boost::mpl::at<typename vtype::value_type::type,boost::mpl::int_<0>>::type T;
1696 :o1(o1),var_id(var_id)
1698 for (
int i = 0 ; i < n ; i++)
1699 {this->comp[i] = comp[i];}
1711 return o1.getVector();
1723 return o1.getVector();
1734 typedef typename pos_or_propL<vtype,exp1::prop>::property_act
property_act;
1778 return this->value(key);
1781 template<
typename Sys_eqs,
typename pmap_type,
typename unordered_map_type,
typename coeff_type>
1782 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
1788 std::cout << __FILE__ <<
":" << __LINE__ <<
" Error it only work for tensore of rank 1 ... like vectors " << std::endl;
1793 o1.template value_nz<Sys_eqs>(p_map,key,cols,coeff,comp_ + var_id + comp[0]);
1800 for (
int i = 0 ; i < n ; i++)
1801 {comp_n[i] = comp[i];}
1820 auto & v = getVector();
1827 auto it = v.getDomainIterator();
1831 auto key = it.get();
1852 auto & v = getVector();
1856 SubsetSelector_impl<std::remove_reference<decltype(v)>::type::is_it_a_subset::value>::check(v2,v);
1858 auto it = v.getDomainIterator();
1862 auto key = it.get();
1881 if (v_exp.getVector().isSubset() ==
true)
1883 std::cout << __FILE__ <<
":" << __LINE__ <<
" error on the right hand side of the expression you have to use non-subset properties" << std::endl;
1884 return this->getVector();
1887 auto &v = o1.getVector();
1894 ::compute_expr_slice(v,v_exp,comp);
1903 return this->getVector();
1915 auto & v = getVector();
1917 auto it = v.getDomainIterator();
1921 auto key = it.get();
1940 template <
unsigned int prp,
unsigned int impl = comp_host,
typename vector>
1956 template<
unsigned int prp>
1964 typedef std::false_type is_ker;
1996 template<
typename Sys_eqs,
typename pmap_type,
typename unordered_map_type,
typename coeff_type>
1997 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
1999 cols[p_map.
template getProp<0>(key)*Sys_eqs::nvar + comp] += coeff;
2010 __host__ __device__
inline double value(
const unsigned int & k)
const
2022 template<
unsigned int prp>
2030 typedef std::false_type is_ker;
2032 typedef void NN_type;
2070 __device__ __host__
inline float value(
const unsigned int & k)
const
2084 template<
unsigned int p1,
unsigned int p2,
typename v1,
typename v2>
2101 template<
typename exp1 ,
typename exp2,
unsigned int op1,
unsigned int prp1,
typename v1>
2118 template<
typename exp1 ,
typename exp2,
unsigned int op1,
unsigned int prp1,
typename v1>
2135 template<
typename exp1 ,
typename exp2,
unsigned int op1,
typename exp3 ,
typename exp4,
unsigned int op2>
2152 template<
unsigned int prp1 ,
typename v1>
2169 template<typename T, unsigned int prp1, typename v1, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2186 template<
unsigned int prp1 ,
typename v1>
2203 template<
unsigned int prp1 ,
typename v1>
2220 template<
typename exp1 ,
typename exp2,
unsigned int op1>
2237 template<typename T, typename exp1 , typename exp2, unsigned int op1, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2254 template<
unsigned int p1,
unsigned int p2,
typename v1,
typename v2>
2272 template<
typename exp1,
typename exp2,
unsigned int op1,
unsigned int p2,
typename v2>
2288 template<
typename exp1,
typename exp2_,
unsigned int op1>
2304 template<
unsigned int p1,
typename v1>
2322 template<
typename exp1,
typename exp2,
unsigned int op1,
unsigned int p2,
typename v2>
2339 template<
typename exp1,
typename exp2,
unsigned int op1,
typename exp3,
typename exp4,
unsigned int op2>
2356 template<
unsigned int prp1,
typename v1>
2374 template<typename T, unsigned int prp1,typename v1, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2391 template<
unsigned int prp1,
typename v1>
2408 template<typename T, unsigned int prp1,typename v1, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2425 template<
unsigned int p2,
typename v2>
2442 template<typename T, unsigned int p2,typename v2, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2459 template<
unsigned int p2,
typename v2>
2476 template<typename T, unsigned int p2,typename v2, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2493 template<
unsigned int p1,
typename v1,
unsigned int p2,
typename v2>
2510 template<
unsigned int p1,
typename v1,
typename exp1,
typename exp2,
unsigned int op1>
2527 template<
unsigned int p1,
typename v1,
typename exp1,
typename exp2,
unsigned int op1>
2544 template<
typename exp1,
typename exp2,
unsigned int op1,
typename exp3 ,
typename exp4,
unsigned int op2>
2561 template<
typename exp1 ,
typename exp2,
unsigned int op1>
2578 template<typename T, typename exp1 , typename exp2, unsigned int op1, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2595 template<
typename exp1 ,
typename exp2,
unsigned int op1>
2612 template<typename T, typename exp1 , typename exp2, unsigned int op1, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2629 template<
typename exp1,
typename exp2,
unsigned int op1>
2646 template<typename T, typename exp1 , typename exp2, unsigned int op1, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2663 template<
typename exp1,
typename exp2,
unsigned int op1>
2680 template<typename T, typename exp1 , typename exp2, unsigned int op1, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2697 template<
unsigned int prp1,
typename v1>
2714 template<typename T, unsigned int prp1,typename v1, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2731 template<
unsigned int prp1,
typename v1>
2748 template<typename T, unsigned int prp1,typename v1, typename sfinae = typename std::enable_if<std::is_same<T,float>::value>::type >
2765 template<
unsigned int prp1,
typename v1,
unsigned int prp2,
typename v2>
2782 template<
unsigned int prp1,
typename v1,
typename exp1,
typename exp2,
unsigned int op1>
2799 template<
unsigned int prp1,
typename v1,
typename exp1,
typename exp2,
unsigned int op1>
2816 template<
typename exp1,
typename exp2,
unsigned int op1,
typename exp3,
typename exp4,
unsigned int op2>
2825 #include "vector_dist_operators_apply_kernel.hpp"
2826 #include "vector_dist_operators_functions.hpp"
2827 #include "vector_dist_operators_extensions.hpp"
2828 #include "Operators/Vector/vector_dist_operator_assign.hpp"
Implementation of 1-D std::vector like structure.
Grid key for a distributed grid.
__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.
Main class that encapsulate a float constant.
vector_dist_expression(const float &d)
constrictor from constant value
__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.
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.
__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.
void init() const
This function must be called before value.
vector v
The temporal vector.
__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
vector & operator=(const vector_dist_expression_op< exp1, exp2, op > &v_exp)
Fill the vector property with the evaluated expression.
vector & operator=(double d)
Fill the vector property with the double.
pos_or_propL< vtype, exp1::prop >::property_act property_act
property on which this view is acting
auto get(const vect_dist_key_dx &key) const -> decltype(value(key))
Return the result of the expression.
__device__ __host__ const vtype & getVector() const
Return the vector on which is acting.
vtype & operator=(const vector_dist_expression< 0, openfpm::vector< aggregate< T >, memory >> &v_exp)
Fill the vector property with the evaluated expression.
void init() const
initialize the expression tree
vtype & operator=(const vector_dist_expression_op< exp1_, exp2_, op > &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.
vtype & operator=(const vector_dist_expression< prp2, vtype > &v_exp)
Fill the vector property with the evaluated expression.
__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 exp2 o2
expression 2
first_or_second< has_vtype< exp1 >::value, exp1, exp2 >::vtype vtype
The type of the internal vector.
const vtype & getVector()
Return the vector on which is acting.
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 * getNN() const
get the NN object
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.
nn_type_result< typename exp1::NN_type, typename exp2::NN_type >::type NN_type
NN_type.
nn_type_result< typename exp1::NN_type, typename exp2::NN_type >::type NN_type
NN_type.
const exp2 o2
expression 2
void init() const
This function must be called before value.
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
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.
vector_dist_expression_op(const exp1 &o1, const exp2 &o2)
constructor from two expressions
const exp2 o2
expression 2
nn_type_result< typename exp1::NN_type, typename exp2::NN_type >::type NN_type
NN_type.
void init() const
This function must be called before value.
NN_type * getNN() const
get the NN object
vector_dist_expression_op(const exp1 &o1, const exp2 &o2)
Costruct a subtraction expression out of two expressions.
const vtype & getVector() const
Return the vector on which is acting.
__device__ __host__ r_type value(const unsigned int &key) const
Evaluate the expression.
const exp1 o1
expression 1
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.
const vtype & getVector()
Return the vector on which is acting.
nn_type_result< typename exp1::NN_type, typename exp2::NN_type >::type NN_type
NN_type.
const exp1 o1
expression 1
const vtype & getVector() const
Return the vector on which is acting.
__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.
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.
NN_type * getNN() const
get the NN object
const exp2 o2
expression 2
const vtype & getVector()
Return the underlying vector.
nn_type_result< typename exp1::NN_type, void >::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
NN_type * getNN() const
get the NN object
vector_result< typename exp1::vtype, void >::type vtype
return the vector type on which this expression operate
__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.
v_mem_mutable< typename vector_expression_transform< vector >::type > v
The vector.
vector & operator=(const vector_dist_expression_op< exp1, exp2, op > &v_exp)
Fill the vector property with the evaluated expression.
vector & operator=(const vector_dist_expression< prp2, vector > &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.
__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 & operator=(double d)
Fill the vector property with the double.
void * getNN() const
get the NN object
vector & operator=(const vector_dist_expression< 0, openfpm::vector_gpu< aggregate< T >>> &v_exp)
Fill the vector property with the evaluated expression.
__host__ __device__ auto value(const unsigned int &k) -> decltype(pos_or_propR< vector, prp >::value(v.v, k))
Evaluate the 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.
void set_vector_dist_ker_list(vector_dist_ker_list< vector > &vdkl)
set vector_dist_ker_list
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.
void add(vector_dist_ker_type &v)
Add a new vector_dist_kernel to track.
void remove(vector_dist_ker_type &v)
Remove one vector_dist_kernels entry.
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)
selector for position or properties right side position
__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
like std::rank but it also work for openfpm structures like Point where it return 1
Expression implementation computation selector.
Expression implementation computation selector.