8#ifndef FD_EXPRESSIONS_HPP_
9#define FD_EXPRESSIONS_HPP_
11template<
typename T,
typename Sfinae =
void>
15struct has_getGrid<T, typename
Void<decltype(std::declval<T>().getGrid())>::type > : std::true_type
21 template<
bool cond,
typename exp1,
typename exp2>
24 static auto getGrid(
const exp1 & o1,
const exp2 & o2) ->
decltype(o2.getGrid())
30 template<
typename exp1,
typename exp2>
33 static auto getGrid(
const exp1 & o1,
const exp2 & o2) ->
decltype(o1.getGrid())
39 constexpr int NORM_EXPRESSION = 0;
40 constexpr int STAG_EXPRESSION = 1;
41 constexpr int GRID_COMP = 2;
43 template <
typename exp1,
typename exp2,
typename impl>
50 template<
unsigned int i>
53 template<
unsigned int prp,
typename base_type,
typename gtype>
56 if (c_where[i] != c_o1[i])
58 int sign = (c_where[i] > c_o1[i])?1:-1;
61 long int x0 = k.getKeyRef().get(i);
63 k.getKeyRef().set_d(i, x0 + sign);
65 k.getKeyRef().set_d(i, x0);
77 template<
unsigned int prp,
typename base_type,
typename gtype>
80 if (c_where[0] != c_o1[0])
82 int sign = (c_where[0] > c_o1[0])?1:-1;
84 inte_out += g.template getProp<prp>(k);
86 long int x0 = k.getKeyRef().get(0);
88 k.getKeyRef().set_d(0, x0 + sign);
89 inte_out += g.template getProp<prp>(k);
90 k.getKeyRef().set_d(0, x0);
95 inte_out += g.template getProp<prp>(k);
101 template<
typename base_type>
104 typedef base_type type;
106 template<
unsigned int prp,
typename gtype>
119 template<
unsigned int prp,
typename gtype>
132 template<
unsigned int prp,
typename gtype>
135 return g.template getProp<prp>(k);
138 template<
unsigned int prp,
typename gtype>
141 return g.template getProp<prp>(k);
144 template<
unsigned int prp,
typename gtype>
147 return g.template getProp<prp>(k);
150 template<
unsigned int prp,
typename gtype>
153 return g.template getProp<prp>(k);
158 template<
unsigned int i>
161 template<
unsigned int prp,
typename base_type,
typename gtype>
164 if (c_where[i] != c_o1[i])
167 long int x0 = k.getKeyRef().get(i);
169 int sign = (c_where[i] > c_o1[i])?1:-1;
171 k.getKeyRef().set_d(i, x0 + sign);
173 k.getKeyRef().set_d(i, x0);
185 template<
unsigned int prp,
typename base_type,
typename gtype>
188 if (c_where[0] != c_o1[0])
190 int sign = (c_where[0] > c_o1[0])?1:-1;
192 inte_out += g.template getProp<prp>(k)[comp[0]];
194 long int x0 = k.getKeyRef().get(0);
196 k.getKeyRef().set_d(0, x0 + sign);
197 inte_out += g.template getProp<prp>(k)[comp[0]];
198 k.getKeyRef().set_d(0, x0);
203 inte_out += g.template getProp<prp>(k)[comp[0]];
209 template<
typename base_type,
unsigned int N1>
212 typedef base_type type;
214 template<
unsigned int prp,
typename gtype>
225 {inte = g.template getProp<prp>(k)[comp];}
230 template<
unsigned int prp,
typename gtype>
233 printf(
"Error wrong expression please check the components");
234 return g.template getProp<prp>(k)[0];
237 template<
unsigned int prp,
typename gtype>
240 return g.template getProp<prp>(k)[comp[0]];
243 template<
unsigned int prp,
typename gtype>
246 printf(
"Error wrong expression please check the components");
247 return g.template getProp<prp>(k)[0];
250 template<
unsigned int prp,
typename gtype>
251 static auto value_ref(gtype & g,
const grid_dist_key_dx<gtype::dims> & k,
const int (& comp)[1]) ->
decltype(g.template getProp<prp>(k)[comp[0]])
253 return g.template getProp<prp>(k)[comp[0]];
260 template<
typename base_type,
unsigned int N1,
unsigned int N2>
263 typedef base_type type;
265 template<
unsigned int prp,
typename gtype>
276 {inte = g.template getProp<prp>(k)[comp[0]][comp[1]];}
281 template<
unsigned int prp,
typename gtype>
284 printf(
"Error wrong expression please check the components");
285 return g.template getProp<prp>(k)[0][0];
288 template<
unsigned int prp,
typename gtype>
291 return g.template getProp<prp>(k)[comp[0]][comp[1]];
294 template<
unsigned int prp,
typename gtype>
297 printf(
"Error wrong expression please check the components");
298 return g.template getProp<prp>(k)[0][0];
301 template<
unsigned int prp,
typename gtype>
302 static auto value_ref(gtype & g,
const grid_dist_key_dx<gtype::dims> & k,
const int (& comp)[2]) ->
decltype(g.template getProp<prp>(k)[0][0])
304 return g.template getProp<prp>(k)[comp[0]][comp[1]];
308 template<
typename base_type,
unsigned int N1,
unsigned int N2,
unsigned int N3>
311 typedef base_type type;
313 template<
unsigned int prp,
typename gtype>
324 {inte = g.template getProp<prp>(k)[comp[0]][comp[1]][comp[2]];}
329 template<
unsigned int prp,
typename gtype>
332 printf(
"Error wrong expression please check the components");
333 return g.template getProp<prp>(k)[0][0][0];
336 template<
unsigned int prp,
typename gtype>
339 printf(
"Error wrong expression please check the components");
340 return g.template getProp<prp>(k)[0][comp[0]][comp[1]];
343 template<
unsigned int prp,
typename gtype>
346 return g.template getProp<prp>(k)[comp[0]][comp[1]][comp[2]];
349 template<
unsigned int prp,
typename gtype>
352 printf(
"Error wrong expression please check the components");
353 return g.template getProp<prp>(k)[0][0][0];
356 template<
unsigned int prp,
typename gtype>
357 static auto value_ref(gtype & g,
const grid_dist_key_dx<gtype::dims> & k,
const int (& comp)[2]) ->
decltype(g.template getProp<prp>(k)[0][0][0])
359 printf(
"Error wrong expression please check the components");
360 return g.template getProp<prp>(k)[0][comp[1]][comp[0]];
363 template<
unsigned int prp,
typename gtype>
364 static auto value_ref(gtype & g,
const grid_dist_key_dx<gtype::dims> & k,
const int (& comp)[3]) ->
decltype(g.template getProp<prp>(k)[0][0][0])
366 return g.template getProp<prp>(k)[comp[0]][comp[1]][comp[2]];
370 template<
typename base_type,
unsigned int N1>
373 typedef base_type type;
375 template<
unsigned int prp,
typename gtype>
379 printf(
"Error wrong expression please check the components");
388 {inte = g.template getProp<prp>(k)[0];}
393 template<
unsigned int prp,
typename gtype>
406 {inte = g.template getProp<prp>(k)[comp[0]];}
411 template<
unsigned int prp,
typename gtype>
414 printf(
"Error wrong expression please check the components");
415 return g.template getProp<prp>(k)[0];
418 template<
unsigned int prp,
typename gtype>
421 return g.template getProp<prp>(k)[comp[0]];
424 template<
unsigned int prp,
typename gtype>
425 static auto value_ref(gtype & g,
const grid_dist_key_dx<gtype::dims> & k,
const int (& comp)[1]) ->
decltype(g.template getProp<prp>(k)[comp[0]])
427 return g.template getProp<prp>(k)[comp[0]];
430 template<
unsigned int prp,
typename gtype>
433 printf(
"Error wrong expression please check the components");
434 return g.template getProp<prp>(k)[0];
438 template<
unsigned int i>
441 template<
typename Sys_eqs,
typename gmap_type,
typename unordered_map_type ,
typename gtype>
442 static void value_nz(
const gmap_type & g_map,
443 unordered_map_type & cols,
448 typename Sys_eqs::stype coeff,
453 if (c_where[i] != c_o1[i])
455 int sign = (c_where[i] > c_o1[i])?1:-1;
475 template<
typename Sys_eqs,
typename gmap_type,
typename unordered_map_type ,
typename gtype>
476 static void value_nz(
const gmap_type & g_map,
477 unordered_map_type & cols,
482 typename Sys_eqs::stype coeff,
487 if (c_where[0] != c_o1[0])
489 int sign = (c_where[0] > c_o1[0])?1:-1;
491 cols[g_map.template getProp<0>(key)*Sys_eqs::nvar + var_id + comp] += coeff / c;
496 cols[g_map.template getProp<0>(key)*Sys_eqs::nvar + var_id + comp] += coeff / c;
501 cols[g_map.template getProp<0>(key)*Sys_eqs::nvar + var_id + comp] += coeff;
506 template<
unsigned int prp,
typename gr
id,
unsigned int impl>
516 template<
unsigned int prp,
typename gr
id>
522 typedef typename boost::mpl::at<typename grid::value_type::type,boost::mpl::int_<prp>>::type type_proc;
530 static const unsigned int prop = prp;
534 void setVarId(
int var_id)
536 this->var_id = var_id;
595 template<
unsigned int nc>
620 template<
unsigned int nc>
640 auto it = g.getDomainIterator();
646 g.template getProp<prp>(key) = g_exp.value(key,s_pos);
668 auto it = g.getDomainIterator();
674 g.template getProp<prp>(key) = g_exp.value(key,s_pos);
691 auto it = g.getDomainIterator();
700 g.template getProp<prp>(key) = d;
709 template<
typename Sys_eqs,
typename gmap_type,
typename unordered_map_type>
710 inline void value_nz(
const gmap_type & g_map,
713 typename Sys_eqs::stype (& spacing )[Sys_eqs::dims],
714 unordered_map_type & cols,
715 typename Sys_eqs::stype coeff,
719 cols[g_map.template getProp<0>(key)*Sys_eqs::nvar + var_id + comp] += coeff;
722 inline grid_dist_expression_op<grid_dist_expression<prp,grid,NORM_EXPRESSION>,boost::mpl::int_<1>,g_comp> operator[](
int comp)
728 grid_dist_expression_op<grid_dist_expression<prp,grid,NORM_EXPRESSION>,boost::mpl::int_<1>,g_comp> v_exp(*
this,comp_n,var_id);
738 return this->value(key,c_where);
746 template<
unsigned int prp,
typename gr
id>
752 typedef typename boost::mpl::at<typename grid::value_type::type,boost::mpl::int_<prp>>::type type_proc;
760 static const unsigned int prop = prp;
764 void setVarId(
int var_id)
766 this->var_id = var_id;
826 template<
unsigned int nc>
854 template<
unsigned int nc>
874 auto it = g.getDomainIterator();
882 g.template getProp<prp>(key) = g_exp.value(key,s_pos);
901 auto it = g.getDomainIterator();
909 g.template getProp<prp>(key) = g_exp.value(key,s_pos);
926 auto it = g.getDomainIterator();
932 g.template getProp<prp>(key) = d;
940 template<
typename Sys_eqs,
typename gmap_type,
typename unordered_map_type>
941 inline void value_nz(
const gmap_type & g_map,
944 typename Sys_eqs::stype (& spacing )[Sys_eqs::dims],
945 unordered_map_type & cols,
946 typename Sys_eqs::stype coeff,
955 for (
int i = 0 ; i < grid::dims ; i++)
957 if (c_where[i] != c_o1[i])
961 grid_dist_expression_value_impl_vnz<Sys_eqs::dims-1>::template value_nz<Sys_eqs>(g_map,cols,g,key,c_where,c_o1,coeff,c,comp,var_id);
965 inline grid_dist_expression_op<grid_dist_expression<prp,grid,STAG_EXPRESSION>,boost::mpl::int_<1>,g_comp> operator[](
int comp)
971 grid_dist_expression_op<grid_dist_expression<prp,grid,STAG_EXPRESSION>,boost::mpl::int_<1>,g_comp> v_exp(*
this,comp_n,var_id);
983 template<
unsigned int dim>
1024 template<
unsigned int dim>
1065 template<
unsigned int dim,
unsigned int impl>
1106 template <
typename exp1,
typename exp2>
1117 typedef typename exp1::gtype gtype;
1144 typename std::remove_reference<
decltype(o1.value(key,c_where))>::type val;
1146 return o1.value(key,c_where) + o2.value(key,c_where);
1158 return o1.getGrid();
1170 return o1.getGrid();
1173 template<
typename Sys_eqs,
typename gmap_type,
typename unordered_map_type>
1174 inline void value_nz(
const gmap_type & g_map,
1177 typename Sys_eqs::stype (& spacing )[Sys_eqs::dims],
1178 unordered_map_type & cols,
1179 typename Sys_eqs::stype coeff,
1183 o1.template value_nz<Sys_eqs>(g_map,key,gs,spacing,cols,coeff,comp,c_where);
1184 o2.template value_nz<Sys_eqs>(g_map,key,gs,spacing,cols,coeff,comp,c_where);
1191 template <
typename exp1,
typename exp2>
1202 typedef typename exp1::gtype gtype;
1229 typename std::remove_reference<
decltype(o1.value(key,c_where))>::type val;
1231 return o1.value(key,c_where) - o2.value(key,c_where);
1243 return o1.getGrid();
1255 return o1.getGrid();
1258 template<
typename Sys_eqs,
typename gmap_type,
typename unordered_map_type>
1259 inline void value_nz(
const gmap_type & g_map,
1262 typename Sys_eqs::stype (& spacing )[Sys_eqs::dims],
1263 unordered_map_type & cols,
1264 typename Sys_eqs::stype coeff,
1268 o1.template value_nz<Sys_eqs>(g_map,key,gs,spacing,cols,coeff,comp,c_where);
1269 o2.template value_nz<Sys_eqs>(g_map,key,gs,spacing,cols,-coeff,comp,c_where);
1275 template <
typename exp1>
1283 typedef typename exp1::gtype gtype;
1309 typename std::remove_reference<
decltype(o1.value(key,c_where))>::type val;
1311 return -o1.value(key,c_where);
1323 return o1.getGrid();
1335 return o1.getGrid();
1338 template<
typename Sys_eqs,
typename gmap_type,
typename unordered_map_type>
1339 inline void value_nz(
const gmap_type & g_map,
1342 typename Sys_eqs::stype (& spacing )[Sys_eqs::dims],
1343 unordered_map_type & cols,
1344 typename Sys_eqs::stype coeff,
1348 o1.template value_nz<Sys_eqs>(g_map,key,gs,spacing,cols,-coeff,comp,c_where);
1354 template <
typename exp1,
typename exp2>
1365 typedef typename exp2::gtype gtype;
1392 typename std::remove_reference<
decltype(o1.value(key,c_where))>::type val;
1394 return o1.value(key,c_where) * o2.value(key,c_where);
1421 template<
typename Sys_eqs,
typename gmap_type,
typename unordered_map_type>
1422 inline void value_nz(
const gmap_type & g_map,
1425 typename Sys_eqs::stype (& spacing )[Sys_eqs::dims],
1426 unordered_map_type & cols,
1427 typename Sys_eqs::stype coeff,
1431 typename Sys_eqs::stype coeff_tmp = o1.value(key,c_where) * coeff;
1433 o2.template value_nz<Sys_eqs>(g_map,key,gs,spacing,cols,coeff_tmp,comp,c_where);
1444 template <
typename gr
id_type,
unsigned int prp>
1450 return v.template getProp<prp>(k);
1454 template<
unsigned int,
bool is_val
id>
1457 template<
typename exp_type>
1460 return o1.value(key,c_where);
1463 template<
typename exp_type>
1466 return o1.value_ref(key,c_where);
1469 template<
unsigned int prop,
typename exp_type,
typename gr
id_type>
1475 template<
unsigned int prop,
typename gr
id_type>
1485 template<
typename exp_type>
1488 printf(
"ERROR: Slicer, the expression is incorrect, please check it\n");
1492 template<
typename exp_type>
1495 printf(
"ERROR: Slicer, the expression is incorrect, please check it\n");
1496 return o1.value_ref(key,c_where);
1499 template<
unsigned int prop,
typename exp_type,
typename gr
id_type>
1502 printf(
"ERROR: Slicer, the expression is incorrect, please check it\n");
1505 template<
unsigned int prop,
typename gr
id_type>
1508 printf(
"ERROR: Slicer, the expression is incorrect, please check it\n");
1515 template<
typename exp_type>
1518 return o1.value(key,c_where,comp);
1521 template<
typename exp_type>
1524 return o1.value_ref(key,c_where,comp);
1527 template<
unsigned int prop,
typename exp_type,
typename gr
id_type>
1533 template<
unsigned int prop,
typename gr
id_type>
1543 template<
typename exp_type>
1546 printf(
"ERROR: Slicer, the expression is incorrect, please check it\n");
1547 return o1.value(key,c_where,comp);
1550 template<
typename exp_type>
1553 printf(
"ERROR: Slicer, the expression is incorrect, please check it\n");
1554 return o1.value_ref(key,c_where,comp);
1557 template<
unsigned int prop,
typename exp_type,
typename gr
id_type>
1560 printf(
"ERROR: Slicer, the expression is incorrect, please check it\n");
1564 template<
unsigned int prop,
typename gr
id_type>
1567 printf(
"ERROR: Slicer, the expression is incorrect, please check it\n");
1575 template<
typename exp_type>
1578 return o1.value(key,c_where,comp);
1581 template<
typename exp_type>
1584 return o1.value_ref(key,c_where,comp);
1587 template<
unsigned int prop,
typename exp_type,
typename gr
id_type>
1593 template<
unsigned int prop,
typename gr
id_type>
1603 template<
typename exp_type>
1606 return o1.value(key,c_where,comp);
1609 template<
typename exp_type>
1612 return o1.value_ref(key,c_where,comp);
1615 template<
unsigned int prop,
typename exp_type,
typename gr
id_type>
1621 template<
unsigned int prop,
typename gr
id_type>
1632 template <
typename exp1,
int n>
1642 void setVarId(
int var_id)
1644 this->var_id = var_id;
1651 typedef std::false_type is_ker;
1653 typedef typename exp1::gtype gtype;
1656 static const unsigned int prop = exp1::prop;
1661 :o1(o1),var_id(var_id)
1663 for (
int i = 0 ; i < n ; i++)
1664 {this->comp[i] = comp[i];}
1676 return o1.getGrid();
1688 return o1.getGrid();
1698 typedef typename boost::mpl::at<typename gtype::value_type::type,boost::mpl::int_<exp1::prop>>::type
property_act;
1742 return this->value(key,c_where);
1745 template<
typename Sys_eqs,
typename gmap_type,
typename unordered_map_type>
1746 inline void value_nz(
const gmap_type & g_map,
1749 typename Sys_eqs::stype (& spacing )[Sys_eqs::dims],
1750 unordered_map_type & cols,
1751 typename Sys_eqs::stype coeff,
1759 std::cout << __FILE__ <<
":" << __LINE__ <<
" Error it only work for tensore of rank 1 ... like vectors " << std::endl;
1764 o1.template value_nz<Sys_eqs>(g_map,key,gs,spacing,cols,coeff,comp_ + var_id + comp[0],c_where);
1767 inline grid_dist_expression_op<exp1,boost::mpl::int_<n+1>,g_comp> operator[](
int comp_)
1771 for (
int i = 0 ; i < n ; i++)
1772 {comp_n[i] = comp[i];}
1775 grid_dist_expression_op<exp1,boost::mpl::int_<n+1>,g_comp> v_exp(o1,comp_n,var_id);
1785 return this->value(key,c_where);
1800 auto & g = getGrid();
1802 auto it = g.getDomainIterator();
1809 auto key = it.get();
1830 auto & g = getGrid();
1832 auto it = g.getDomainIterator();
1839 auto key = it.get();
1858 auto & v = getGrid();
1860 auto it = v.getDomainIterator();
1864 auto key = it.get();
1888 template <
unsigned int prp,
typename gr
id>
inline grid_dist_expression<prp,grid,NORM_EXPRESSION> getV(
grid & g)
1890 grid_dist_expression<prp,grid,NORM_EXPRESSION> exp_g(g);
1901 template <
unsigned int prp,
typename gr
id>
inline grid_dist_expression<prp,grid,STAG_EXPRESSION> getV_stag(
grid & g)
1903 grid_dist_expression<prp,grid,STAG_EXPRESSION> exp_g(g);
1911 template<
unsigned int dim>
1920 bool is_equal = gdb_ext.
size() == tmp.gdb_ext.
size();
1922 for (
int i = 0 ; i < gdb_ext.
size() ; i++)
1924 is_equal &= gdb_ext.get(i) == tmp.gdb_ext.get(i);
1927 is_equal &= ginfo_v == tmp.ginfo_v;
1933 template<
unsigned int dim>
1948 static constexpr unsigned int dims = dim;
1962 template<
unsigned int prp>
2025 size_t Nloc_grid = input.gdb_ext.
size();
2029 for (
int i = 0 ; i < Nloc_grid; i++)
2033 for (
int j = 0 ; j < dim ; j++) {sz[j] = input.gdb_ext.get(i).GDbox.getKP2().get(j) + 1;}
2038 gdb_ext = input.gdb_ext;
2043 decltype(device_grid::type_of_subiterator()),FREE> getIterator()
2051 decltype(device_grid::type_of_subiterator()),
2058 template<
typename patches>
2061 static constexpr unsigned int dims = patches::dims;
2072 template<
unsigned int dim>
2083 typedef double type_proc;
2085 template<
typename super_general>
2086 void operator_equal(super_general & g_exp)
2090 resize(g_exp.getGrid());
2095 auto it = this->getVector().getIterator();
2099 auto key = it.get();
2101 data.loc_grid.get(key.
getSub()).template get<0>(key.
getKey()) = g_exp.value(key,s_pos);
2109 static constexpr unsigned int dims = dim;
2117 static const unsigned int prop = 0;
2128 template<
typename gr
id>
2134 template<
typename gr
id>
2135 void resize(
grid & g)
2137 size_t Nloc_grid = g.getN_loc_grid();
2139 data.loc_grid.resize(Nloc_grid);
2141 for (
int i = 0 ; i < Nloc_grid; i++)
2143 data.loc_grid.get(i).resize(g.get_loc_grid(i).getGrid().getSize());
2146 gdb_ext = g.getLocalGridsInfo();
2147 ginfo_v = g.getGridInfoVoid();
2150 grid_dist_expression_iterator_to_make_algebra_work<dim> getVector()
const
2152 return grid_dist_expression_iterator_to_make_algebra_work<dim>(data.loc_grid,gdb_ext,ginfo_v);
2196 return data.loc_grid.get(k.getSub()).template get<0>(k.getKey());
2221 return data.loc_grid.get(k.getSub()).template get<0>(k.getKey());
2233 operator_equal(g_exp);
2235 return g_exp.getGrid();
2247 operator_equal(g_exp);
2249 return g_exp.getGrid();
2257 return this->value(key,c_where);
2278template<
unsigned int p1,
unsigned int p2,
typename g1,
typename g2,
unsigned int impl_p1,
unsigned int impl_p2>
2295template<
typename exp1 ,
typename exp2,
typename op1,
unsigned int prp1,
typename g1,
unsigned int impl_p1>
2312template<
typename exp1 ,
typename exp2,
typename op1,
unsigned int prp1,
typename g1,
unsigned int impl_p1>
2329template<
typename exp1 ,
typename exp2,
typename op1,
typename exp3 ,
typename exp4,
typename op2>
2346template<
unsigned int prp1 ,
typename g1,
unsigned int impl_p1>
2363template<
unsigned int prp1 ,
typename g1,
unsigned int impl_p1>
2380template<
typename exp1 ,
typename exp2,
typename op1>
2397template<
unsigned int p1,
unsigned int p2,
typename g1,
typename g2,
unsigned int impl_p1,
unsigned int impl_p2>
2414template<
typename exp1 ,
typename exp2,
typename op1,
unsigned int prp1,
typename g1,
unsigned int impl_p1>
2431template<
typename exp1 ,
typename exp2,
typename op1,
unsigned int prp1,
typename g1,
unsigned int impl_p1>
2447template<
typename exp1 ,
typename exp2_,
typename op1>
2456template<
unsigned int prp1 ,
typename g1,
unsigned int impl_p1>
2474template<
typename exp1 ,
typename exp2,
typename op1,
typename exp3 ,
typename exp4,
typename op2>
2491template<
unsigned int prp1 ,
typename g1,
unsigned int impl_p1>
2508template<
unsigned int prp1 ,
typename g1,
unsigned int impl_p1>
2525template<
typename exp1 ,
typename exp2,
typename op1>
2542template<
unsigned int p2,
typename g2,
unsigned int impl_p2>
2559template<
unsigned int p2,
typename g2,
unsigned int impl_p2>
2576template<
unsigned int p1,
typename v1,
unsigned int p2,
typename v2,
unsigned int impl_p1,
unsigned int impl_p2>
2593template<
unsigned int p1,
typename v1,
typename exp1,
typename exp2,
typename op1,
unsigned int impl_p1>
2610template<
unsigned int p1,
typename v1,
typename exp1,
typename exp2,
typename op1,
unsigned int impl_p1>
2627template<
typename exp1,
typename exp2,
typename op1,
typename exp3 ,
typename exp4,
typename op2>
2644template<
typename exp1 ,
typename exp2,
typename op1>
2661template<
typename exp1 ,
typename exp2,
typename op1>
void init() const
This function must be called before value.
auto operator=(const grid_dist_expression_op< exp1, exp2, op > &g_exp) -> decltype(g_exp.getGrid())
Fill the grid property with the evaluated expression.
const grid_dist_expression_iterator_to_make_algebra_work< dim > getGrid() const
Return the grid on which is acting.
grid_dist_expression(grid &g)
constructor for an external grid
const grid & operator=(const grid_dist_expression< prp2, grid, NORM_EXPRESSION > &g_exp)
Fill the grid property with the evaluated expression.
grid_sm< dim, void > ginfo_v
Grid informations object without type.
double & value_ref(const grid_dist_key_dx< dim > &k, const comb< dim > &c_where=comb< dim >())
Evaluate the expression.
grid_dist_expression_iterator_to_make_algebra_work< dim > gtype
The type of the internal grid.
double value(const grid_dist_key_dx< dim > &k, const comb< dim > &c_where=comb< dim >()) const
Evaluate the expression.
grid_dist_expression_iterator_to_make_algebra_work< dim > getGrid()
Return the grid on which is acting.
grid_patches< grid_cpu< dim, aggregate< double > > > data
The grid.
double d
constant parameter
double value(const grid_dist_key_dx< dim > &k, comb< dim > &c_where) const
Evaluate the expression.
grid_dist_expression(const double &d)
constructor from a constant expression
void init() const
This function must be called before value.
void init() const
This function must be called before value.
double value(const grid_dist_key_dx< dim > &k, comb< dim > &c_where) const
Evaluate the expression.
double d
constant parameter
grid_dist_expression(const double &d)
constructor from a constant expression
float value(const grid_dist_key_dx< dim > &k) const
Evaluate the expression.
grid_dist_expression(const float &d)
constrictor from constant value
float vtype
type of object the structure return then evaluated
void init() const
This function must be called before value.
grid & getGrid()
Return the grid on which is acting.
auto value(const grid_dist_key_dx< grid::dims > &k, comb< grid::dims > &c_where) const -> decltype(grid_dist_expression_value_impl< type_proc >::template value_n< prp >(g, k))
Evaluate the expression.
auto value_ref(const grid_dist_key_dx< grid::dims > &k, comb< grid::dims > &c_where, const int(&comp)[nc]) const -> decltype(grid_dist_expression_value_impl< type_proc >::template value_ref< prp >(g, k, comp))
Evaluate the expression.
auto value_ref(const grid_dist_key_dx< grid::dims > &k, comb< grid::dims > &c_where) const -> decltype(grid_dist_expression_value_impl< type_proc >::template value_ref< prp >(g, k))
Evaluate the expression.
grid_dist_expression(grid &g)
constructor for an external grid
grid & operator=(const grid_dist_expression< prp2, grid_type, NORM_EXPRESSION > &g_exp)
Fill the grid property with the evaluated expression.
grid & operator=(double d)
Fill the grid property with the double.
void init() const
This function must be called before value.
auto value(const grid_dist_key_dx< grid::dims > &k, comb< grid::dims > &c_where, const int(&comp)[nc]) const -> decltype(grid_dist_expression_value_impl< type_proc >::template value_n< prp >(g, k, comp))
Evaluate the expression.
const grid & getGrid() const
Return the grid on which is acting.
grid gtype
The type of the internal grid.
grid & operator=(const grid_dist_expression_op< exp1, exp2, op > &g_exp)
Fill the grid property with the evaluated expression.
void init() const
This function must be called before value.
grid & getGrid()
Return the grid on which is acting.
const grid & getGrid() const
Return the grid on which is acting.
grid gtype
The type of the internal grid.
grid & operator=(const grid_dist_expression_op< exp1, exp2, op > &g_exp)
Fill the grid property with the evaluated expression.
grid_dist_expression(grid &g)
constructor for an external grid
grid & operator=(double d)
Fill the grid property with the double.
auto value_ref(const grid_dist_key_dx< grid::dims > &k, comb< grid::dims > &c_where) const -> decltype(grid_dist_expression_value_impl< type_proc >::template value_ref< prp >(g, k))
Evaluate the expression.
auto value_ref(const grid_dist_key_dx< grid::dims > &k, comb< grid::dims > &c_where, const int(&comp)[nc]) const -> decltype(grid_dist_expression_value_impl< type_proc >::template value_ref< prp >(g, k, comp))
Evaluate the expression.
auto value(grid_dist_key_dx< grid::dims > &k, comb< grid::dims > &c_where) const -> decltype(grid_dist_expression_value_impl< type_proc >::template inte< prp >(g, k, c_where, c_where))
Evaluate the expression.
grid & operator=(const grid_dist_expression< prp2, grid, STAG_EXPRESSION > &g_exp)
Fill the grid property with the evaluated expression.
auto value(const grid_dist_key_dx< grid::dims > &k, comb< grid::dims > &c_where, const int(&comp)[nc]) const -> decltype(grid_dist_expression_value_impl< type_proc >::template inte< prp >(g, k, c_where, c_where, comp))
Evaluate the expression.
const device_grid & get_loc_grid(size_t i) const
Get the i sub-domain grid.
const grid_sm< dim, void > & getGridInfoVoid() const
Get an object containing the grid informations without type.
openfpm::vector< grid_cpu< dim, aggregate< double > > > & loc_grid
The grid.
device_grid & get_loc_grid(size_t i)
Get the i sub-domain grid.
size_t getN_loc_grid() const
Return the number of local grid.
const openfpm::vector< GBoxes< device_grid::dims > > & getLocalGridsInfo() const
It return the informations about the local grids.
grid_sm< dim, void > & ginfo_v
Grid informations object without type.
auto get(grid_dist_key_dx< gtype::dims > &key, comb< gtype::dims > &c_where) const -> decltype(value(key, c_where))
Return the result of the expression.
const gtype & getGrid() const
Return the vector on which is acting.
void init() const
initialize the expression tree
gtype & getGrid()
Return the vector on which is acting.
auto value(grid_dist_key_dx< gtype::dims > &key, comb< gtype::dims > &c_where) const -> decltype(get_grid_dist_expression_op< n, n==rank_gen< property_act >::type::value >::get(o1, key, c_where, comp))
Return the result of the expression.
gtype & operator=(const grid_dist_expression< prp2, gtype2, impl > &v_exp)
Fill the vector property with the evaluated expression.
gtype & operator=(double d)
Fill the vector property with the double.
boost::mpl::at< typenamegtype::value_type::type, boost::mpl::int_< exp1::prop > >::type property_act
property on which this view is acting
grid_dist_expression_op(const exp1 &o1, int(&comp)[n], int var_id)
constructor from an expresssion
gtype & operator=(const grid_dist_expression_op< exp1_, exp2_, op > &v_exp)
Fill the vector property with the evaluated expression.
auto value_ref(grid_dist_key_dx< gtype::dims > &key, comb< gtype::dims > &c_where) const -> decltype(get_grid_dist_expression_op< n, n==rank_gen< property_act >::type::value >::get_ref(o1, key, c_where, comp))
Return the result of the expression.
const exp2 o2
expression 1
auto value(grid_dist_key_dx< gtype::dims > &key, comb< gtype::dims > &c_where) const -> typename std::remove_reference< decltype(o1.value(key, c_where))>::type
Evaluate the expression.
const exp1 o1
expression 1
void init() const
This function must be called before value.
auto getGrid() -> decltype(first_or_second< has_getGrid< exp1 >::value, exp1, exp2 >::getGrid(o1, o2))
Return the grid on which is acting.
auto getGrid() const -> decltype(first_or_second< has_getGrid< exp1 >::value, exp1, exp2 >::getGrid(o1, o2))
Return the grid on which is acting.
grid_dist_expression_op(const exp1 &o1, const exp2 &o2)
Costruct a FD expression out of two expressions.
void init() const
This function must be called before value.
const exp2 o2
expression 1
const exp1 o1
expression 1
gtype & getGrid()
Return the grid on which is acting.
auto value(grid_dist_key_dx< gtype::dims > &key, comb< gtype::dims > &c_where) const -> typename std::remove_reference< decltype(o1.value(key, c_where))>::type
Evaluate the expression.
grid_dist_expression_op(const exp1 &o1, const exp2 &o2)
Costruct a FD expression out of two expressions.
const gtype & getGrid() const
Return the grid on which is acting.
grid_dist_expression_op(const exp1 &o1, const exp2 &o2)
Costruct a FD expression out of two expressions.
gtype & getGrid()
Return the grid on which is acting.
const exp2 o2
expression 1
const exp1 o1
expression 1
auto value(grid_dist_key_dx< gtype::dims > &key, comb< gtype::dims > &c_where) const -> typename std::remove_reference< decltype(o1.value(key, c_where))>::type
Evaluate the expression.
const gtype & getGrid() const
Return the grid on which is acting.
void init() const
This function must be called before value.
auto value(grid_dist_key_dx< gtype::dims > &key, comb< gtype::dims > &c_where) const -> typename std::remove_reference< decltype(o1.value(key, c_where))>::type
Evaluate the expression.
void init() const
This function must be called before value.
gtype & getGrid()
Return the grid on which is acting.
grid_dist_expression_op(const exp1 &o1)
Costruct a FD expression out of two expressions.
const gtype & getGrid() const
Return the grid on which is acting.
const exp1 o1
expression 1
This class implement the point shape in an N-dimensional space.
This is a distributed grid.
Distributed grid iterator.
Grid key for a distributed grid.
size_t getSub() const
Get the local grid.
base_key getKey() const
Get the key.
base_key & getKeyRef()
Get the reference key.
grid_key_dx is the key to access any element in the grid
void one()
Set to one the key.
__device__ __host__ const size_t(& getSize() const)[N]
Return the size of the grid as an array.
Implementation of 1-D std::vector like structure.
selector for position or properties left side expression
__device__ static __host__ auto value(grid_type &v, const grid_dist_key_dx< grid_type::dims > &k) -> decltype(v.template getProp< prp >(k))
return the value (position or property) of the particle k in the vector v
This structure store the Box that define the domain inside the Ghost + domain box.
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...
Position of the element of dimension d in the hyper-cube of dimension dim.
void mone()
Set all the elements to -1.
void zero()
Set all the elements to zero.