24 #ifndef VISIONCPP_INCLUDE_FRAMEWORK_EVALUATOR_EVAL_EXPRESSION_EVAL_EXPR_ASSIGN_HPP_
25 #define VISIONCPP_INCLUDE_FRAMEWORK_EVALUATOR_EVAL_EXPRESSION_EVAL_EXPR_ASSIGN_HPP_
31 template <
typename LHS,
typename RHS,
size_t Cols,
size_t Rows,
size_t LfType,
32 size_t LVL,
typename Loc,
typename... Params>
37 -> decltype(LHS_Eval_Expr::get_accessor(t)) {
38 return LHS_Eval_Expr::get_accessor(t);
43 decltype(LHS_Eval_Expr::get_accessor(t))>::Type {
44 auto x = RHS_Eval_Expr::eval_point(cOffset, t);
45 LHS_Eval_Expr::eval_point(cOffset, t) = x;
49 template <
bool IsRoot,
size_t Halo_Top,
size_t Halo_Left,
size_t Halo_Butt,
50 size_t Halo_Right,
size_t Offset,
size_t Index,
size_t LC,
57 constexpr
bool isLocal =
59 LHS_Eval_Expr::get_accessor(t))>::Type>::scope ==
scope::Local;
60 constexpr
size_t LC_Ratio = RHS::CThread / Cols;
61 constexpr
size_t LR_Ratio = RHS::RThread / Rows;
63 auto nested_accessor =
64 RHS_Eval_Expr::template eval_neighbour<IsRoot, Halo_Top, Halo_Left,
65 Halo_Butt, Halo_Right, Offset,
66 Index, LC, LR>(cOffset, t);
67 constexpr
bool isLocal_nested =
70 auto rhs_acc = nested_accessor.get_pointer();
71 auto lhs_acc = LHS_Eval_Expr::get_accessor(t).get_pointer();
72 if ((cOffset.l_c < (cOffset.cLRng / LC_Ratio)) &&
73 (cOffset.l_r < (cOffset.rLRng / LR_Ratio))) {
74 size_t g_c = ((cOffset.g_c - cOffset.l_c) / LC_Ratio) + cOffset.l_c;
75 size_t g_r = ((cOffset.g_r - cOffset.l_r) / LR_Ratio) + cOffset.l_r;
76 for (
int i = 0; i < LC / LC_Ratio; i += (cOffset.cLRng / LC_Ratio)) {
77 if (get_compare<isLocal, LC / LC_Ratio, Cols>(cOffset.l_c, i, g_c)) {
78 for (
size_t j = 0; j < LR / LR_Ratio;
79 j += (cOffset.rLRng / LR_Ratio)) {
80 if (get_compare<isLocal, LR / LR_Ratio, Rows>(cOffset.l_r, j,
83 id_val<isLocal>(cOffset.l_r, g_r) + j,
84 id_val<isLocal>(LC / LC_Ratio, Cols),
85 id_val<isLocal>(LR / LR_Ratio, Rows))] =
87 LfType, decltype(nested_accessor)>::Type>(
89 id_val<isLocal_nested>(cOffset.l_c, g_c) + i,
90 id_val<isLocal_nested>(cOffset.l_r, g_r) + j,
91 id_val<isLocal_nested>(LC / LC_Ratio, Cols),
92 id_val<isLocal_nested>(LR / LR_Ratio, Rows))]);
105 template <
bool IsRoot,
size_t Offset,
size_t Index,
size_t LC,
size_t LR>
112 auto rhs_acc = RHS_Eval_Expr::template eval_global_neighbour<IsRoot, Offset,
114 cOffset, t).get_pointer();
115 auto lhs_acc = LHS_Eval_Expr::get_accessor(t).get_pointer();
118 for (
int i = 0; i < LC; i += cOffset.cLRng) {
119 if (get_compare<false, LC, Cols>(cOffset.l_c, i, cOffset.g_c)) {
120 for (
int j = 0; j < LR; j += cOffset.rLRng) {
121 if (get_compare<false, LR, Rows>(cOffset.l_r, j, cOffset.g_r)) {
124 lhs_acc[index] = rhs_acc[index];
133 return RHS_Eval_Expr::template eval_global_neighbour<IsRoot, Offset,
134 Index - 1>(cOffset, t);
static size_t calculate_index(size_t c, size_t r, size_t cols, size_t rows)
function calculate_index
static constexpr ScopeType Local
The definition is in Assign file.
static auto eval_global_neighbour(Loc &cOffset, const tools::tuple::Tuple< Params... > &t) -> decltype(tools::tuple::get< OutputLocation< IsRoot, Offset+Index - 1 >::ID >(t))
evaluate function when the internal::ops_category is GlobalNeighbour.
static auto eval_neighbour(Loc &cOffset, const tools::tuple::Tuple< Params... > &t) -> decltype(tools::tuple::get< OutputLocation< IsRoot, Offset+Index - 1 >::ID >(t))
evaluate function when the internal::ops_category is NeighbourOP.
static auto eval_point(Loc &cOffset, const tools::tuple::Tuple< Params... > &t) -> typename MemoryTrait< LfType, decltype(LHS_Eval_Expr::get_accessor(t))>::Type
evaluate function when the internal::ops_category is PointOP.
static auto get_accessor(const tools::tuple::Tuple< Params... > &t) -> decltype(LHS_Eval_Expr::get_accessor(t))
eval_global_neighbour function:
This class is used to determine the ElementType of accessor template parameters.
This is used to find whether a node should use a global memory output or a local memory output is cre...
This struct is used to trait the value type inside the accessor.