8#ifndef OPENFPM_DATA_SRC_SPACE_SHAPE_POINT_OPERATORS_HPP_
9#define OPENFPM_DATA_SRC_SPACE_SHAPE_POINT_OPERATORS_HPP_
11#include "util/multi_array_openfpm/array_openfpm.hpp"
13template<
unsigned int dim ,
typename T>
class Point;
19#define POINT_MUL_POINT 5
49#define POINT_TGAMMA 33
50#define POINT_LGAMMA 34
55#define POINT_NEARBYINT 39
57#define POINT_SUB_UNI 41
58#define POINT_NORM_INF 42
63template<
bool cond,
typename exp1,
typename exp2>
66 typedef typename exp2::coord_type coord_type;
69template<
typename exp1,
typename exp2>
72 typedef typename exp1::coord_type coord_type;
75template<
typename T,
typename Sfinae =
void>
91template<
typename source1,
typename source2>
97template<
typename source2>
100 typedef source2 type;
103template<
typename source2>
106 typedef source2 type;
109template<
typename source2>
112 typedef source2 type;
115template<
typename source2>
118 typedef source2 type;
121template<
typename source1>
124 typedef source1 type;
127template<
typename source1>
130 typedef source1 type;
133template<
typename source1>
136 typedef source1 type;
139template<
typename source1>
142 typedef source1 type;
145template<
typename source1,
typename source2>
153constexpr unsigned int max_expr(
unsigned int dim1,
unsigned int dim2)
155 return (dim1 > dim2)?dim1:dim2;
167template <
unsigned int op1_dim,
unsigned int op2_dim,
unsigned int op>
173 value = max_expr(op1_dim,op2_dim),
200template <
unsigned int op1_dim,
unsigned int op2_dim>
238template <
unsigned int r,
typename orig>
250template <
typename orig>
254 typedef typename orig::coord_type
type;
277 static const unsigned int nvals = 1;
279 typedef T coord_type;
295 __device__ __host__
inline void init()
const
306 __device__ __host__
inline const T &
value(
const int k)
const
318 __device__ __host__
inline T &
value(
const int k)
334template <
typename orig,
typename exp1,
typename exp2,
unsigned int op>
347template <
typename orig,
typename exp1,
typename exp2>
390 __device__ __host__
inline void init()
const
403 template<
typename r_type=
typename best_conv<
typename std::remove_reference<
decltype(o1.value(0))>::type,
404 typename std::remove_reference<
decltype(o2.value(0))>::type>::type >
405 __device__ __host__
inline r_type
value(
size_t k)
const
407 return o1.value(k) + o2.value(k);
414 template<typename T, typename test=typename boost::disable_if_c< std::is_same<T,orig>::value || exp1::nvals != 1 || exp2::nvals != 1 >::type >
415 __device__ __host__
inline operator T()
const
418 return o1.value(0) + o2.value(0);
428 template<
typename r_type=
typename best_conv<
typename std::remove_reference<
decltype(o1.value(0))>::type,
429 typename std::remove_reference<
decltype(o2.value(0))>::type>::type >
430 __device__ __host__
inline r_type
operator[](
size_t i)
432 return o1.value(i) + o2.value(i);
442template <
typename orig,
typename exp1,
typename exp2>
485 __device__ __host__
inline void init()
const
498 template<
typename r_type=
typename best_conv<
typename std::remove_reference<
decltype(o1.value(0))>::type,
499 typename std::remove_reference<
decltype(o2.value(0))>::type>::type >
500 __device__ __host__
inline r_type
value(
size_t k)
const
502 return o1.value(k) - o2.value(k);
509 template<typename T, typename test=typename boost::disable_if_c< std::is_same<T,orig>::value || exp1::nvals != 1 || exp2::nvals != 1 >::type >
510 __device__ __host__
operator T()
const
513 return o1.value(0) - o2.value(0);
526template <
typename orig,
typename exp1,
typename exp2>
533 mutable typename orig::coord_type
scal;
550 static const unsigned int nvals = exp1::nvals;
565 __device__ __host__
inline void init()
const
577 template<
typename r_type=
typename std::remove_reference<
decltype(o1.value(0))>::type >
578 __device__ __host__
inline r_type
value(
size_t k)
const
580 return -(o1.value(k));
584 template <typename T, typename check = typename std::enable_if<!std::is_same<T,orig>::value >::type >
585 __device__ __host__
operator T()
const
588 return -(o1.value(0));
601template <
typename orig,
typename exp1,
typename exp2>
610 mutable typename std::remove_const<typename orig::coord_type>::type
scal;
630 static const unsigned int nvals = 1;
639 :o1(o1),o2(o2),scal(0.0)
647 __device__ __host__
inline void init()
const
652 for (
size_t i = 0 ; i < orig::dims ; i++)
653 scal += o1.value(i) * o2.value(i);
663 template<
typename r_type=
typename best_conv<
typename std::remove_reference<
decltype(o1.value(0))>::type,
664 typename std::remove_reference<
decltype(o2.value(0))>::type>::type >
665 __device__ __host__
inline r_type
value(
size_t k)
const
671 template<typename T, typename test=typename boost::disable_if_c< std::is_same<T,orig>::value >::type >
672 __device__ __host__
operator T()
const
687template <
typename orig,
typename exp1,
typename exp2>
730 __device__ __host__
inline void init()
const
741 template<
typename r_type=
typename best_conv<
typename std::remove_reference<
decltype(o1.value(0))>::type,
742 typename std::remove_reference<
decltype(o2.value(0))>::type>::type >
743 __device__ __host__
inline r_type
value(
size_t k)
const
745 return o1.value(k) * o2.value(k);
752 template<typename T, typename test=typename boost::disable_if_c< std::is_same<T,orig>::value || exp1::nvals != 1 || exp2::nvals != 1 >::type >
753 __device__ __host__
operator T()
const
756 return o1.value(0) * o2.value(0);
767template <
typename orig,
typename exp1,
typename exp2>
811 __device__ __host__
inline void init()
const
824 template<
typename r_type=
typename best_conv<
typename std::remove_reference<
decltype(o1.value(0))>::type,
825 typename std::remove_reference<
decltype(o2.value(0))>::type>::type >
826 __device__ __host__
inline r_type
value(
size_t k)
const
828 return o1.value(k) / o2.value(k);
836 template<typename T, typename test=typename boost::disable_if_c< std::is_same<T,orig>::value || exp1::nvals != 1 || exp2::nvals != 1 >::type > __device__ __host__
operator T()
const
839 return o1.value(0) / o2.value(0);
867template<
unsigned int dim,
typename T>
870 template<
typename vmpl> __device__ __host__
878 getExprR(T (& a)[dim])
883 template<
typename vmpl> __device__ __host__
891 getExprL(T (& a)[dim])
903#define CREATE_POINT_OPERATOR(operator_name,OP_ID) \
906template<unsigned int dim, typename T>\
907__device__ __host__ inline point_expression_op<Point<dim,T>,Point<dim,T>,point_expression<const T[dim]>,OP_ID>\
908operator_name(const Point<dim,T> & va, const point_expression<const T[(unsigned int)dim]> & vb)\
910 point_expression_op<Point<dim,T>,Point<dim,T>,point_expression<const T[dim]>,OP_ID> exp_sum(va,vb);\
915template<unsigned int dim, typename T, typename vmpl>\
916__device__ __host__ inline point_expression_op<Point<dim,T>,Point<dim,T>,point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>>,OP_ID>\
917operator_name(const Point<dim,T> & va, const point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>> & vb)\
919 point_expression_op<Point<dim,T>,Point<dim,T>,point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>>,OP_ID> exp_sum(va,vb);\
924template<unsigned int dim, typename T>\
925__device__ __host__ inline point_expression_op<Point<dim,T>,point_expression<const T[dim]>,Point<dim,T>,OP_ID>\
926operator_name(const point_expression<const T[(unsigned int)dim]> & va, const Point<dim,T> & vb)\
928 point_expression_op<Point<dim,T>,point_expression<const T[dim]>,Point<dim,T>,OP_ID> exp_sum(va,vb);\
933template<unsigned int dim, typename T, typename vmpl>\
934__device__ __host__ inline point_expression_op<Point<dim,T>,point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>>,Point<dim,T>,OP_ID>\
935operator_name(const point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>> & va,\
936 const Point<dim,T> & vb)\
938 point_expression_op<Point<dim,T>,point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>>,Point<dim,T>,OP_ID> exp_sum(va,vb);\
943template<unsigned int dim, typename T>\
944__device__ __host__ inline point_expression_op<Point<dim,T>,point_expression<const T[dim]>,point_expression<double>,OP_ID>\
945operator_name(const point_expression<const T[dim]> & va, double d)\
947 point_expression_op<Point<dim,T>,point_expression<const T[dim]>,point_expression<double>,OP_ID> exp_sum(va,point_expression<double>(d));\
952template<typename T, typename vmpl>\
953__device__ __host__ inline point_expression_op<Point<subar_dim<vmpl>::type::value,T>,\
954 point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>>,\
955 point_expression<double>,\
957operator_name(const point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>> & va, double d)\
959 point_expression_op<Point<subar_dim<vmpl>::type::value,T>,\
960 point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>>,\
961 point_expression<double>,\
963 exp_sum(va,point_expression<double>(d));\
968template<unsigned int dim, typename T>\
969__device__ __host__ inline point_expression_op<Point<dim,T>,point_expression<double>,point_expression<const T[dim]>,OP_ID>\
970operator_name(double d, const point_expression<const T[dim]> & va)\
972 point_expression_op<Point<dim,T>,point_expression<double>,point_expression<const T[dim]>,OP_ID> exp_sum(point_expression<double>(d),va);\
977template<typename T, typename vmpl>\
978__device__ __host__ inline point_expression_op<Point<subar_dim<vmpl>::type::value,T>,\
979 point_expression<double>,\
980 point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>>,\
982operator_name(double d, const point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>> & va)\
984 point_expression_op<Point<subar_dim<vmpl>::type::value,T>,\
985 point_expression<double>,\
986 point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>>,\
988 exp_sum(point_expression<double>(d),va);\
993template<unsigned int dim, typename T>\
994__device__ __host__ inline point_expression_op<Point<dim,T>,point_expression<const T[dim]>,point_expression<const T[dim]>,OP_ID>\
995operator_name(const point_expression<const T[dim]> & va, const point_expression<const T[dim]> & vb)\
997 point_expression_op<Point<dim,T>,point_expression<const T[dim]>,point_expression<const T[dim]>,OP_ID> exp_sum(va,vb);\
1002template<typename T, typename vmpl>\
1003__device__ __host__ inline point_expression_op<Point<subar_dim<vmpl>::type::value,T>,\
1004 point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>>,\
1005 point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>>,\
1007operator_name(const point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>> & va,\
1008 const point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>> & vb)\
1010 point_expression_op<Point<subar_dim<vmpl>::type::value,T>,\
1011 point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>>,\
1012 point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>>,\
1013 OP_ID> exp_sum(va,vb);\
1018template<unsigned int dim, typename T>\
1019__device__ __host__ inline point_expression_op<Point<dim,T>,point_expression<const T[dim]>,point_expression<T[dim]>,OP_ID>\
1020operator_name(const point_expression<const T[dim]> & va, const point_expression<T[dim]> & vb)\
1022 point_expression_op<Point<dim,T>,point_expression<const T[dim]>,point_expression<T[dim]>,OP_ID> exp_sum(va,vb);\
1027template<typename orig, typename exp1 , typename exp2, unsigned int op1, unsigned int dim, typename T>\
1028__device__ __host__ inline point_expression_op<orig,point_expression_op<orig,exp1,exp2,op1>,point_expression<T[dim]>,OP_ID>\
1029operator_name(const point_expression_op<orig,exp1,exp2,op1> & va, const point_expression<T[dim]> & vb)\
1031 point_expression_op<orig,point_expression_op<orig,exp1,exp2,op1>,point_expression<T[dim]>,OP_ID> exp_sum(va,vb);\
1036template<typename orig, typename exp1 , typename exp2, unsigned int op1, typename T, typename vmpl>\
1037__device__ __host__ inline point_expression_op<orig,\
1038 point_expression_op<orig,exp1,exp2,op1>,\
1039 point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>>,\
1041operator_name(const point_expression_op<orig,exp1,exp2,op1> & va,\
1042 const point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>> & vb)\
1044 point_expression_op<orig,\
1045 point_expression_op<orig,exp1,exp2,op1>,\
1046 point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>>,\
1047 OP_ID> exp_sum(va,vb);\
1052template<typename orig, typename exp1 , typename exp2, unsigned int op1, unsigned int dim, typename T>\
1053__device__ __host__ inline point_expression_op<orig,point_expression<T[dim]>,point_expression_op<orig,exp1,exp2,op1>,OP_ID>\
1054operator_name(const point_expression<T[dim]> & va, const point_expression_op<orig,exp1,exp2,op1> & vb)\
1056 point_expression_op<orig,point_expression<T[dim]>,point_expression_op<orig,exp1,exp2,op1>,OP_ID> exp_sum(va,vb);\
1061template<typename orig, typename exp1 , typename exp2, unsigned int op1, typename T, typename vmpl>\
1062__device__ __host__ inline point_expression_op<orig,\
1063 point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>>,\
1064 point_expression_op<orig,exp1,exp2,op1>,\
1066operator_name(const point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>> & va,\
1067 const point_expression_op<orig,exp1,exp2,op1> & vb)\
1069 point_expression_op<orig,\
1070 point_expression<openfpm::detail::multi_array::sub_array_openfpm<T,1,vmpl>>,\
1071 point_expression_op<orig,exp1,exp2,op1>,\
1072 OP_ID> exp_sum(va,vb);\
1078template<unsigned int dim, typename T>\
1079__device__ __host__ inline point_expression_op<Point<dim,T>,Point<dim,T>,Point<dim,T>,OP_ID>\
1080operator_name(const Point<dim,T> & va, const Point<dim,T> & vb)\
1082 point_expression_op<Point<dim,T>,Point<dim,T>,Point<dim,T>,OP_ID> exp_sum(va,vb);\
1087template<typename orig, typename exp1 , typename exp2, unsigned int op1, unsigned int dim, typename T>\
1088__device__ __host__ inline point_expression_op<orig,point_expression_op<orig,exp1,exp2,op1>,Point<dim,T>,OP_ID>\
1089operator_name(const point_expression_op<orig,exp1,exp2,op1> & va, const Point<dim,T> & vb)\
1091 point_expression_op<orig,point_expression_op<orig,exp1,exp2,op1>,Point<dim,T>,OP_ID> exp_sum(va,vb);\
1096template<typename orig,typename exp1 , typename exp2, unsigned int op1, unsigned int dim, typename T>\
1097__device__ __host__ inline point_expression_op<Point<dim,T>,Point<dim,T>,point_expression_op<orig,exp1,exp2,op1>,OP_ID>\
1098operator_name(const Point<dim,T> & va, const point_expression_op<orig,exp1,exp2,op1> & vb)\
1100 point_expression_op<Point<dim,T>,Point<dim,T>,point_expression_op<orig,exp1,exp2,op1>,OP_ID> exp_sum(va,vb);\
1105template<typename orig, typename exp1 , typename exp2, unsigned int op1, typename T>\
1106__device__ __host__ inline point_expression_op<orig,point_expression_op<orig,exp1,exp2,op1>,point_expression<T>,OP_ID>\
1107operator_name(const point_expression_op<orig,exp1,exp2,op1> & va, T d)\
1109 point_expression_op<orig,point_expression_op<orig,exp1,exp2,op1>,point_expression<T>,OP_ID> exp_sum(va,d);\
1114template<typename orig,typename exp1 , typename exp2, unsigned int op1, typename T>\
1115__device__ __host__ inline point_expression_op<orig,point_expression<T>,point_expression_op<orig,exp1,exp2,op1>,OP_ID>\
1116operator_name(T d, const point_expression_op<orig,exp1,exp2,op1> & vb)\
1118 point_expression_op<orig,point_expression<T>,point_expression_op<orig,exp1,exp2,op1>,OP_ID> exp_sum(d,vb);\
1123template<typename orig,typename exp1 , typename exp2, unsigned int op1, typename exp3 , typename exp4, unsigned int op2>\
1124__device__ __host__ inline point_expression_op<orig,point_expression_op<orig,exp1,exp2,op1>,point_expression_op<orig,exp3,exp4,op2>,OP_ID>\
1125operator_name(const point_expression_op<orig,exp1,exp2,op1> & va, const point_expression_op<orig,exp3,exp4,op2> & vb)\
1127 point_expression_op<orig,point_expression_op<orig,exp1,exp2,op1>,point_expression_op<orig,exp3,exp4,op2>,OP_ID> exp_sum(va,vb);\
1132template<unsigned int dim , typename T, typename check=typename std::enable_if< !std::is_same<T,double>::value >::type >\
1133__device__ __host__ inline point_expression_op<Point<dim,T>,Point<dim,T>,point_expression<T>,OP_ID>\
1134operator_name(const Point<dim,T> & va, T d)\
1136 point_expression_op<Point<dim,T>,Point<dim,T>,point_expression<T>,OP_ID> exp_sum(va,point_expression<T>(d));\
1141template<unsigned int dim , typename T>\
1142__device__ __host__ inline point_expression_op<Point<dim,T>,Point<dim,T>,point_expression<double>,OP_ID>\
1143operator_name(const Point<dim,T> & va, double d)\
1145 point_expression_op<Point<dim,T>,Point<dim,T>,point_expression<double>,OP_ID> exp_sum(va,point_expression<double>(d));\
1150template<unsigned int dim , typename T, typename check=typename std::enable_if< !std::is_same<T,double>::value >::type >\
1151__device__ __host__ inline point_expression_op<Point<dim,T>,point_expression<T>,Point<dim,T>,OP_ID>\
1152operator_name(T d, const Point<dim,T> & vb)\
1154 point_expression_op<Point<dim,T>,point_expression<T>,Point<dim,T>,OP_ID> exp_sum(point_expression<T>(d),vb);\
1159template<unsigned int dim, typename T, typename check=typename std::enable_if< !std::is_same<T,double>::value >::type>\
1160__device__ __host__ inline point_expression_op<Point<dim,T>,point_expression<T[dim]>,Point<dim,T>,OP_ID>\
1161operator_name(T (& d)[dim], const Point<dim,T> & vb)\
1163 point_expression_op<Point<dim,T>,point_expression<T[dim]>,Point<dim,T>,OP_ID> exp_sum(point_expression<T[dim]>(d),vb);\
1168template<unsigned int dim , typename T>\
1169__device__ __host__ inline point_expression_op<Point<dim,T>,point_expression<double>,Point<dim,T>,OP_ID>\
1170operator_name(double d, const Point<dim,T> & vb)\
1172 point_expression_op<Point<dim,T>,point_expression<double>,Point<dim,T>,OP_ID> exp_sum(point_expression<double>(d),vb);\
1177template<typename orig, typename exp1 , typename exp2, unsigned int op1, typename T, typename check=typename std::enable_if< !std::is_same<T,double>::value >::type >\
1178__device__ __host__ inline point_expression_op<orig,point_expression_op<orig,exp1,exp2,op1>,point_expression<T>,OP_ID>\
1179operator_name(const point_expression_op<orig,exp1,exp2,op1> & va, T d)\
1181 point_expression_op<orig,point_expression_op<orig,exp1,exp2,op1>,point_expression<T>,OP_ID> exp_sum(va,point_expression<T>(d));\
1186template<typename orig, typename exp1 , typename exp2, unsigned int op1, typename T>\
1187__device__ __host__ inline point_expression_op<orig,point_expression_op<orig,exp1,exp2,op1>,point_expression<double>,OP_ID>\
1188operator_name(const point_expression_op<orig,exp1,exp2,op1> & va, double d)\
1190 point_expression_op<orig,point_expression_op<orig,exp1,exp2,op1>,point_expression<double>,OP_ID> exp_sum(va,point_expression<double>(d));\
1196CREATE_POINT_OPERATOR(
operator+,POINT_SUM)
1197CREATE_POINT_OPERATOR(
operator-,POINT_SUB)
1198CREATE_POINT_OPERATOR(
operator/,POINT_DIV)
1208template<typename orig, typename exp1 , typename exp2, unsigned int op1, typename T, typename check=typename std::enable_if< ! std::is_same<T,orig>::value >::type >
1209__device__ __host__
inline T &
1228template<
typename orig,
typename exp1 ,
typename exp2,
unsigned int op1,
typename T>
1229__device__ __host__
inline T &
1246template<
typename orig,
typename exp1,
typename exp2,
unsigned int op1>
1262template<
unsigned int dim,
typename T>
1277template<
unsigned int dim,
typename T>
1286template<
typename T,
typename vmpl>
1302template<
unsigned int dim,
typename T>
1312template<
typename T,
typename vmpl>
1328template<
unsigned int dim,
typename T>
1337template<
typename T,
typename vmpl>
1348 POINT_MUL_POINT> exp_sum(va,vb);
1353template<unsigned int dim, typename T, typename check=typename std::enable_if< !std::is_same<T,double>::value >::type>
1364template<
typename orig,
1370 typename sfinae =
typename std::enable_if< point_expression_op<orig,exp1,exp2,op1>::nvals == dim >::type >
1380 POINT_MUL_POINT> exp_sum(va,vb);
1385template<
typename orig,
1401 POINT_MUL_POINT> exp_sum(va,vb);
1406template<
typename orig,
1412 typename sfinae =
typename std::enable_if< point_expression_op<orig,exp1,exp2,op1>::nvals == 1 >::type >
1421template<
typename orig,
1427 typename sfinae =
typename std::enable_if< point_expression_op<orig,exp1,exp2,op1>::nvals == 1 >::type >
1437 POINT_MUL> exp_sum(va,vb);
1444template<
typename orig,
1450 typename sfinae =
typename std::enable_if< point_expression_op<orig,exp1,exp2,op1>::nvals == dim >::type >
1459template<
typename orig,
1475 POINT_MUL_POINT> exp_sum(va,vb);
1480template<
typename orig,
1486 typename sfinae =
typename std::enable_if< point_expression_op<orig,exp1,exp2,op1>::nvals == 1 >::type >
1495template<
typename orig,
1501 typename sfinae =
typename std::enable_if< point_expression_op<orig,exp1,exp2,op1>::nvals == 1 >::type >
1511 POINT_MUL> exp_sum(va,vb);
1526template<
unsigned int dim,
typename T>
1543template<unsigned int dim, typename T, typename check=typename std::enable_if< !std::is_same<T,double>::value >::type >
1560template<
unsigned int dim,
typename T>
1577template<
unsigned int dim,
typename T>
1594template<
typename orig,
1600 typename sfinae =
typename std::enable_if<point_expression_op<orig,exp1,exp2,op1>::nvals != 1>::type >
1617template<
typename orig,
1623 typename sfinae =
typename std::enable_if<point_expression_op<orig,exp1,exp2,op1>::nvals == 1>::type >
1640template<
typename orig,
1646 typename sfinae =
typename std::enable_if<point_expression_op<orig,exp1,exp2,op1>::nvals != 1>::type >
1663template<
typename orig,
1669 typename check =
typename std::enable_if<point_expression_op<orig,exp1,exp2,op1>::nvals == 1>::type >
1686template<
typename orig,
typename T,
typename exp1,
typename exp2,
unsigned int op1>
1704template<
typename orig,
typename exp1,
typename exp2,
unsigned int op1,
typename T>
1722template<
typename orig,
1733 point_expression_op<orig,point_expression_op<orig,exp1,exp2,op1>,
point_expression_op<orig,exp3,exp4,op2>,POINT_MUL_POINT> exp_sum(va,vb);
1746template<
typename orig,
1757 point_expression_op<orig,point_expression_op<orig,exp1,exp2,op1>,
point_expression_op<orig,exp3,exp4,op2>,POINT_MUL> exp_sum(va,vb);
1772template<
unsigned int dim,
typename T>
1789template<
typename orig,
unsigned int dim,
typename T,
typename exp1,
typename exp2,
unsigned int op1>
1806template<
typename orig,
unsigned int dim,
typename T,
typename exp1,
typename exp2,
unsigned int op1>
1823template<
typename orig,
typename exp1,
typename exp2,
unsigned int op1,
typename exp3 ,
typename exp4,
unsigned int op2>
1827 point_expression_op<orig,point_expression_op<orig,exp1,exp2,op1>,
point_expression_op<orig,exp3,exp4,op2>,POINT_MUL> exp_sum(va,vb);
1839template<
typename T,
unsigned int dim>
1881 template<
typename orig,
typename exp1,
typename exp2,
unsigned int op>
1886 for (
size_t i = 0; i < dim ; i++)
1887 {
d[i] = p_exp.value(i);}
1899 template<
typename T_>
1904 for (
size_t i = 0; i < dim ; i++)
1931 __device__ __host__
inline void init()
const
1944 __device__ __host__
inline T
value(
const size_t k)
const
1957template<
typename T,
unsigned int dim>
1992 __device__ __host__
inline void init()
const
2013 __device__ __host__
inline T
value(
const size_t k)
const
2025template<
typename T,
typename vmpl>
2057 template<
typename orig,
typename exp1,
typename exp2,
unsigned int op>
2063 for (
size_t i = 0; i <
nvals ; i++)
2064 {
d[i] = p_exp.value(i);}
2075 :
d(
d.origin_mutable(),
d.strides())
2084 __device__ __host__
inline void init()
const
2117 __device__ __host__
inline T &
value(
const int k)
2131 __device__ __host__
inline T &
value(
const int k)
const
2137#include "Point_operators_functions.hpp"
This class implement the point shape in an N-dimensional space.
__device__ __host__ const T & operator[](int n) const
Array operator.
__device__ __host__ point_expression< T[dim]> & operator=(const point_expression_op< orig, exp1, exp2, op > &p_exp)
Operator= for point expression.
__device__ __host__ T & operator[](int n)
Array operator.
point_expression(T(&d)[dim])
constructor from an array
T coord_type
The type of the internal vector.
int has_init
indicate that init must be called before value
__device__ __host__ point_expression< T[dim]> & operator=(const point_expression< T_ > &p_exp)
Operator= for point expression.
__device__ __host__ T value(const size_t k) const
Evaluate the expression at coordinate k.
__device__ __host__ void init() const
This function must be called before value.
int is_expression
indicate that this class encapsulate an expression
T operator[](int n) const
Array operator.
__device__ __host__ T value(const size_t k) const
Evaluate the expression at coordinate k.
int is_expression
indicate that this class encapsulate an expression
__device__ __host__ point_expression(const T(&d)[dim])
construct from an array of dimension dim
T coord_type
The type of the internal vector.
__device__ __host__ void init() const
This function must be called before value.
int has_init
indicate that init must be called before value
openfpm::detail::multi_array::sub_array_openfpm< T, 1, vmpl > d
array view of dimension dim
__device__ __host__ T & operator[](int k) const
Same as value()
__device__ __host__ void init() const
This function must be called before value.
int is_expression
indicate that this class encapsulate an expression
int has_init
indicate that init must be called before value
__device__ __host__ T & operator[](int k)
Same as value()
T coord_type
The type of the internal vector.
__device__ __host__ T & value(const int k)
Evaluate the expression at coordinate k.
__device__ __host__ point_expression< openfpm::detail::multi_array::sub_array_openfpm< T, 1, vmpl > > & operator=(const point_expression_op< orig, exp1, exp2, op > &p_exp)
Operator= for point expression.
__device__ __host__ point_expression(const openfpm::detail::multi_array::sub_array_openfpm< T, 1, vmpl > &d)
construct from an array of dimension dim
__device__ __host__ T & value(const int k) const
Evaluate the expression at coordinate k.
__device__ __host__ void init() const
This function must be called before value.
const exp1 o1
expression 1
int is_expression
indicate that this class encapsulate an expression
__device__ __host__ r_type value(size_t k) const
Evaluate the expression.
const exp2 o2
expression 2
__device__ __host__ point_expression_op(const exp1 &o1, const exp2 &o2)
constructor from expression 1 and expression 2
orig orig_type
original type
orig return_type
return type of the expression
int has_init
indicate that init must be called before value
first_or_second_pt< has_coordtype< exp1 >::value, exp1, exp2 >::coord_type coord_type
The type of the internal vector.
const exp1 o1
expression 1
__device__ __host__ r_type value(size_t k) const
Evaluate the expression.
__device__ __host__ void init() const
This function must be called before value.
int is_expression
indicate that this class encapsulate an expression
orig return_type
return type of the expression
first_or_second_pt< has_coordtype< exp1 >::value, exp1, exp2 >::coord_type coord_type
The type of the internal vector.
int has_init
indicate that init must be called before value
orig orig_type
origin type
__device__ __host__ point_expression_op(const exp1 &o1, const exp2 &o2)
constructor from 2 expression
const exp2 o2
expression 2
const exp2 o2
second expression
__device__ __host__ point_expression_op(const exp1 &o1, const exp2 &o2)
constructor from 2 expressions
const exp1 o1
first expression
orig::coord_type return_type
return type of the expression
int is_expression
indicate that this class encapsulate an expression
orig orig_type
base type of the expression
__device__ __host__ void init() const
This function must be called before value.
__device__ __host__ r_type value(size_t k) const
Evaluate the expression.
first_or_second_pt< has_coordtype< exp1 >::value, exp1, exp2 >::coord_type coord_type
The type of the internal vector.
std::remove_const< typenameorig::coord_type >::type scal
the expression produce a scalar
int has_init
indicate that init must be called before value
int has_init
indicate that init must be called before value
__device__ __host__ r_type value(size_t k) const
Evaluate the expression at coordinate k.
int is_expression
indicate that this class encapsulate an expression
orig return_type
return type of the expression
orig orig_type
Original type.
__device__ __host__ void init() const
This function must be called before value.
const exp2 o2
expression 2
__device__ __host__ point_expression_op(const exp1 &o1, const exp2 &o2)
constructor from 2 expressions
const exp1 o1
expression 1
first_or_second_pt< has_coordtype< exp1 >::value, exp1, exp2 >::coord_type coord_type
The type of the internal vector.
orig::coord_type scal
scalar value produced by the expression
orig orig_type
original type
int has_init
indicate that this class has an init function
__device__ __host__ void init() const
initialize the the expression
int is_expression
indicate that is an expression
__device__ __host__ point_expression_op(const exp1 &o1)
first_or_second_pt< has_coordtype< exp1 >::value, exp1, exp2 >::coord_type coord_type
The type of the internal vector.
orig::coord_type return_type
return type of the expression evaluation
__device__ __host__ r_type value(size_t k) const
evaluate the expression
first_or_second_pt< has_coordtype< exp1 >::value, exp1, exp2 >::coord_type coord_type
The type of the internal vector.
const exp1 o1
first expression
r_type_p< r_type_dim< exp1::nvals, exp2::nvals, POINT_SUM >::value, orig >::type return_type
return type of the expression
orig orig_type
original type of the point expression
int has_init
indicate that init must be called before value
__device__ __host__ point_expression_op(const exp1 &o1, const exp2 &o2)
Constructor from 2 point expressions.
__device__ __host__ void init() const
This function must be called before value.
const exp2 o2
second expression
__device__ __host__ r_type value(size_t k) const
Evaluate the expression at coordinate k.
int is_expression
indicate that this class encapsulate an expression
Unknown operation specialization.
Main class that encapsulate a constant number used in a point expression.
__device__ __host__ T & value(const int k)
Evaluate the expression.
__device__ __host__ void init() const
This function must be called before value.
static const unsigned int nvals
this operation produce a vector as result of size dims
__device__ __host__ point_expression(T &d)
constructor from a value
__device__ __host__ const T & value(const int k) const
Evaluate the expression.
int is_expression
indicate that this class encapsulate an expression
int has_init
indicate that init must be called before value
convert a type into constant type
It return the dimansionality of the operation given the dimensionality of the 2 operators.
orig::coord_type type
meta-function return a scalar or the expression produce a scalar
Return type of the expression.
orig type
meta-function return orig or the expression produce a vector
return the dimension of the sub_array