8 #ifndef FD_EXPRESSIONS_HPP_
9 #define FD_EXPRESSIONS_HPP_
11 template<
typename T,
typename Sfinae =
void>
15 struct 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);
64 if (g.getLocalGrid().get(k.getSub()).getGrid().size(i) > k.getKey().get(i)) {
69 k.getKeyRef().set_d(i, x0);
81 template<
unsigned int prp,
typename base_type,
typename gtype>
84 if (c_where[0] != c_o1[0])
86 int sign = (c_where[0] > c_o1[0])?1:-1;
88 inte_out += g.template getProp<prp>(k);
90 long int x0 = k.getKeyRef().get(0);
92 k.getKeyRef().set_d(0, x0 + sign);
93 inte_out += g.template getProp<prp>(k);
94 k.getKeyRef().set_d(0, x0);
99 inte_out += g.template getProp<prp>(k);
105 template<
typename base_type>
108 typedef base_type type;
110 template<
unsigned int prp,
typename gtype>
123 template<
unsigned int prp,
typename gtype>
136 template<
unsigned int prp,
typename gtype>
139 return g.template getProp<prp>(k);
142 template<
unsigned int prp,
typename gtype>
145 return g.template getProp<prp>(k);
148 template<
unsigned int prp,
typename gtype>
151 return g.template getProp<prp>(k);
154 template<
unsigned int prp,
typename gtype>
157 return g.template getProp<prp>(k);
162 template<
unsigned int i>
165 template<
unsigned int prp,
typename base_type,
typename gtype>
168 if (c_where[i] != c_o1[i])
171 long int x0 = k.getKeyRef().get(i);
173 int sign = (c_where[i] > c_o1[i])?1:-1;
175 k.getKeyRef().set_d(i, x0 + sign);
177 k.getKeyRef().set_d(i, x0);
189 template<
unsigned int prp,
typename base_type,
typename gtype>
192 if (c_where[0] != c_o1[0])
194 int sign = (c_where[0] > c_o1[0])?1:-1;
196 inte_out += g.template getProp<prp>(k)[comp[0]];
198 long int x0 = k.getKeyRef().get(0);
200 k.getKeyRef().set_d(0, x0 + sign);
201 inte_out += g.template getProp<prp>(k)[comp[0]];
202 k.getKeyRef().set_d(0, x0);
207 inte_out += g.template getProp<prp>(k)[comp[0]];
213 template<
typename base_type,
unsigned int N1>
216 typedef base_type type;
218 template<
unsigned int prp,
typename gtype>
229 {inte = g.template getProp<prp>(k)[comp];}
234 template<
unsigned int prp,
typename gtype>
237 printf(
"Error wrong expression please check the components");
238 return g.template getProp<prp>(k)[0];
241 template<
unsigned int prp,
typename gtype>
244 return g.template getProp<prp>(k)[comp[0]];
247 template<
unsigned int prp,
typename gtype>
250 printf(
"Error wrong expression please check the components");
251 return g.template getProp<prp>(k)[0];
254 template<
unsigned int prp,
typename gtype>
255 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]])
257 return g.template getProp<prp>(k)[comp[0]];
264 template<
typename base_type,
unsigned int N1,
unsigned int N2>
267 typedef base_type type;
269 template<
unsigned int prp,
typename gtype>
280 {inte = g.template getProp<prp>(k)[comp[0]][comp[1]];}
285 template<
unsigned int prp,
typename gtype>
288 printf(
"Error wrong expression please check the components");
289 return g.template getProp<prp>(k)[0][0];
292 template<
unsigned int prp,
typename gtype>
295 return g.template getProp<prp>(k)[comp[0]][comp[1]];
298 template<
unsigned int prp,
typename gtype>
301 printf(
"Error wrong expression please check the components");
302 return g.template getProp<prp>(k)[0][0];
305 template<
unsigned int prp,
typename gtype>
306 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])
308 return g.template getProp<prp>(k)[comp[0]][comp[1]];
312 template<
typename base_type,
unsigned int N1,
unsigned int N2,
unsigned int N3>
315 typedef base_type type;
317 template<
unsigned int prp,
typename gtype>
328 {inte = g.template getProp<prp>(k)[comp[0]][comp[1]][comp[2]];}
333 template<
unsigned int prp,
typename gtype>
336 printf(
"Error wrong expression please check the components");
337 return g.template getProp<prp>(k)[0][0][0];
340 template<
unsigned int prp,
typename gtype>
343 printf(
"Error wrong expression please check the components");
344 return g.template getProp<prp>(k)[0][comp[0]][comp[1]];
347 template<
unsigned int prp,
typename gtype>
350 return g.template getProp<prp>(k)[comp[0]][comp[1]][comp[2]];
353 template<
unsigned int prp,
typename gtype>
356 printf(
"Error wrong expression please check the components");
357 return g.template getProp<prp>(k)[0][0][0];
360 template<
unsigned int prp,
typename gtype>
361 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])
363 printf(
"Error wrong expression please check the components");
364 return g.template getProp<prp>(k)[0][comp[1]][comp[0]];
367 template<
unsigned int prp,
typename gtype>
368 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])
370 return g.template getProp<prp>(k)[comp[0]][comp[1]][comp[2]];
374 template<
typename base_type,
unsigned int N1>
377 typedef base_type type;
379 template<
unsigned int prp,
typename gtype>
383 printf(
"Error wrong expression please check the components");
392 {inte = g.template getProp<prp>(k)[0];}
397 template<
unsigned int prp,
typename gtype>
410 {inte = g.template getProp<prp>(k)[comp[0]];}
415 template<
unsigned int prp,
typename gtype>
418 printf(
"Error wrong expression please check the components");
419 return g.template getProp<prp>(k)[0];
422 template<
unsigned int prp,
typename gtype>
425 return g.template getProp<prp>(k)[comp[0]];
428 template<
unsigned int prp,
typename gtype>
429 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]])
431 return g.template getProp<prp>(k)[comp[0]];
434 template<
unsigned int prp,
typename gtype>
437 printf(
"Error wrong expression please check the components");
438 return g.template getProp<prp>(k)[0];
442 template<
unsigned int i>
445 template<
typename Sys_eqs,
typename gmap_type,
typename unordered_map_type ,
typename gtype>
446 static void value_nz(
const gmap_type & g_map,
447 unordered_map_type & cols,
452 typename Sys_eqs::stype coeff,
457 if (c_where[i] != c_o1[i])
459 int sign = (c_where[i] > c_o1[i])?1:-1;
479 template<
typename Sys_eqs,
typename gmap_type,
typename unordered_map_type ,
typename gtype>
480 static void value_nz(
const gmap_type & g_map,
481 unordered_map_type & cols,
486 typename Sys_eqs::stype coeff,
491 if (c_where[0] != c_o1[0])
493 int sign = (c_where[0] > c_o1[0])?1:-1;
495 cols[g_map.template getProp<0>(key)*Sys_eqs::nvar + var_id + comp] += coeff / c;
500 cols[g_map.template getProp<0>(key)*Sys_eqs::nvar + var_id + comp] += coeff / c;
505 cols[g_map.template getProp<0>(key)*Sys_eqs::nvar + var_id + comp] += coeff;
510 template<
unsigned int prp,
typename gr
id,
unsigned int impl>
520 template<
unsigned int prp,
typename gr
id>
526 typedef typename boost::mpl::at<typename grid::value_type::type,boost::mpl::int_<prp>>::type type_proc;
534 static const unsigned int prop = prp;
538 void setVarId(
int var_id)
540 this->var_id = var_id;
599 template<
unsigned int nc>
624 template<
unsigned int nc>
644 auto it = g.getDomainIterator();
650 g.template getProp<prp>(key) = g_exp.value(key,s_pos);
672 auto it = g.getDomainIterator();
678 g.template getProp<prp>(key) = g_exp.value(key,s_pos);
695 auto it = g.getDomainIterator();
704 g.template getProp<prp>(key) = d;
713 template<
typename Sys_eqs,
typename gmap_type,
typename unordered_map_type>
714 inline void value_nz(
const gmap_type & g_map,
717 typename Sys_eqs::stype (& spacing )[Sys_eqs::dims],
718 unordered_map_type & cols,
719 typename Sys_eqs::stype coeff,
723 cols[g_map.template getProp<0>(key)*Sys_eqs::nvar + var_id + comp] += coeff;
726 inline grid_dist_expression_op<grid_dist_expression<prp,grid,NORM_EXPRESSION>,boost::mpl::int_<1>,g_comp> operator[](
int comp)
732 grid_dist_expression_op<grid_dist_expression<prp,grid,NORM_EXPRESSION>,boost::mpl::int_<1>,g_comp> v_exp(*
this,comp_n,var_id);
742 return this->value(key,c_where);
750 template<
unsigned int prp,
typename gr
id>
756 typedef typename boost::mpl::at<typename grid::value_type::type,boost::mpl::int_<prp>>::type type_proc;
764 static const unsigned int prop = prp;
768 void setVarId(
int var_id)
770 this->var_id = var_id;
830 template<
unsigned int nc>
859 template<
unsigned int nc>
864 if (comp[0] < g.getStagPositions()[prp].size())
865 c_o1 = g.getStagPositions()[prp].get(comp[0]);
867 c_o1 = g.getStagPositions()[prp].get(0);
884 auto it = g.getDomainIterator();
892 g.template getProp<prp>(key) = g_exp.value(key,s_pos);
911 auto it = g.getDomainIterator();
912 const auto& gLocalGrid = g.getLocalGrid();
920 g.template getProp<prp>(key) = g_exp.value(key,s_pos);
937 auto it = g.getDomainIterator();
943 g.template getProp<prp>(key) = d;
951 template<
typename Sys_eqs,
typename gmap_type,
typename unordered_map_type>
952 inline void value_nz(
const gmap_type & g_map,
955 typename Sys_eqs::stype (& spacing )[Sys_eqs::dims],
956 unordered_map_type & cols,
957 typename Sys_eqs::stype coeff,
966 for (
int i = 0 ; i < grid::dims ; i++)
968 if (c_where[i] != c_o1[i])
972 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);
976 inline grid_dist_expression_op<grid_dist_expression<prp,grid,STAG_EXPRESSION>,boost::mpl::int_<1>,g_comp> operator[](
int comp)
982 grid_dist_expression_op<grid_dist_expression<prp,grid,STAG_EXPRESSION>,boost::mpl::int_<1>,g_comp> v_exp(*
this,comp_n,var_id);
994 template<
unsigned int dim>
1035 template<
unsigned int dim>
1076 template<
unsigned int dim,
unsigned int impl>
1117 template <
typename exp1,
typename exp2>
1128 typedef typename exp1::gtype gtype;
1155 typename std::remove_reference<decltype(o1.value(key,c_where))>::type val;
1157 return o1.value(key,c_where) + o2.value(key,c_where);
1169 return o1.getGrid();
1181 return o1.getGrid();
1184 template<
typename Sys_eqs,
typename gmap_type,
typename unordered_map_type>
1185 inline void value_nz(
const gmap_type & g_map,
1188 typename Sys_eqs::stype (& spacing )[Sys_eqs::dims],
1189 unordered_map_type & cols,
1190 typename Sys_eqs::stype coeff,
1194 o1.template value_nz<Sys_eqs>(g_map,key,gs,spacing,cols,coeff,comp,c_where);
1195 o2.template value_nz<Sys_eqs>(g_map,key,gs,spacing,cols,coeff,comp,c_where);
1202 template <
typename exp1,
typename exp2>
1213 typedef typename exp1::gtype gtype;
1240 typename std::remove_reference<decltype(o1.value(key,c_where))>::type val;
1242 return o1.value(key,c_where) - o2.value(key,c_where);
1254 return o1.getGrid();
1266 return o1.getGrid();
1269 template<
typename Sys_eqs,
typename gmap_type,
typename unordered_map_type>
1270 inline void value_nz(
const gmap_type & g_map,
1273 typename Sys_eqs::stype (& spacing )[Sys_eqs::dims],
1274 unordered_map_type & cols,
1275 typename Sys_eqs::stype coeff,
1279 o1.template value_nz<Sys_eqs>(g_map,key,gs,spacing,cols,coeff,comp,c_where);
1280 o2.template value_nz<Sys_eqs>(g_map,key,gs,spacing,cols,-coeff,comp,c_where);
1286 template <
typename exp1>
1294 typedef typename exp1::gtype gtype;
1320 typename std::remove_reference<decltype(o1.value(key,c_where))>::type val;
1322 return -o1.value(key,c_where);
1334 return o1.getGrid();
1346 return o1.getGrid();
1349 template<
typename Sys_eqs,
typename gmap_type,
typename unordered_map_type>
1350 inline void value_nz(
const gmap_type & g_map,
1353 typename Sys_eqs::stype (& spacing )[Sys_eqs::dims],
1354 unordered_map_type & cols,
1355 typename Sys_eqs::stype coeff,
1359 o1.template value_nz<Sys_eqs>(g_map,key,gs,spacing,cols,-coeff,comp,c_where);
1365 template <
typename exp1,
typename exp2>
1376 typedef typename exp2::gtype gtype;
1403 typename std::remove_reference<decltype(o1.value(key,c_where))>::type val;
1405 return o1.value(key,c_where) * o2.value(key,c_where);
1432 template<
typename Sys_eqs,
typename gmap_type,
typename unordered_map_type>
1433 inline void value_nz(
const gmap_type & g_map,
1436 typename Sys_eqs::stype (& spacing )[Sys_eqs::dims],
1437 unordered_map_type & cols,
1438 typename Sys_eqs::stype coeff,
1442 typename Sys_eqs::stype coeff_tmp = o1.value(key,c_where) * coeff;
1444 o2.template value_nz<Sys_eqs>(g_map,key,gs,spacing,cols,coeff_tmp,comp,c_where);
1455 template <
typename gr
id_type,
unsigned int prp>
1461 return v.template getProp<prp>(k);
1465 template<
unsigned int,
bool is_val
id>
1468 template<
typename exp_type>
1471 return o1.value(key,c_where);
1474 template<
typename exp_type>
1477 return o1.value_ref(key,c_where);
1480 template<
unsigned int prop,
typename exp_type,
typename gr
id_type>
1486 template<
unsigned int prop,
typename gr
id_type>
1496 template<
typename exp_type>
1499 printf(
"ERROR: Slicer, the expression is incorrect, please check it\n");
1503 template<
typename exp_type>
1506 printf(
"ERROR: Slicer, the expression is incorrect, please check it\n");
1507 return o1.value_ref(key,c_where);
1510 template<
unsigned int prop,
typename exp_type,
typename gr
id_type>
1513 printf(
"ERROR: Slicer, the expression is incorrect, please check it\n");
1516 template<
unsigned int prop,
typename gr
id_type>
1519 printf(
"ERROR: Slicer, the expression is incorrect, please check it\n");
1526 template<
typename exp_type>
1529 return o1.value(key,c_where,comp);
1532 template<
typename exp_type>
1535 return o1.value_ref(key,c_where,comp);
1538 template<
unsigned int prop,
typename exp_type,
typename gr
id_type>
1544 template<
unsigned int prop,
typename gr
id_type>
1554 template<
typename exp_type>
1557 printf(
"ERROR: Slicer, the expression is incorrect, please check it\n");
1558 return o1.value(key,c_where,comp);
1561 template<
typename exp_type>
1564 printf(
"ERROR: Slicer, the expression is incorrect, please check it\n");
1565 return o1.value_ref(key,c_where,comp);
1568 template<
unsigned int prop,
typename exp_type,
typename gr
id_type>
1571 printf(
"ERROR: Slicer, the expression is incorrect, please check it\n");
1575 template<
unsigned int prop,
typename gr
id_type>
1578 printf(
"ERROR: Slicer, the expression is incorrect, please check it\n");
1586 template<
typename exp_type>
1589 return o1.value(key,c_where,comp);
1592 template<
typename exp_type>
1595 return o1.value_ref(key,c_where,comp);
1598 template<
unsigned int prop,
typename exp_type,
typename gr
id_type>
1604 template<
unsigned int prop,
typename gr
id_type>
1614 template<
typename exp_type>
1617 return o1.value(key,c_where,comp);
1620 template<
typename exp_type>
1623 return o1.value_ref(key,c_where,comp);
1626 template<
unsigned int prop,
typename exp_type,
typename gr
id_type>
1632 template<
unsigned int prop,
typename gr
id_type>
1643 template <
typename exp1,
int n>
1653 void setVarId(
int var_id)
1655 this->var_id = var_id;
1662 typedef std::false_type is_ker;
1664 typedef typename exp1::gtype gtype;
1667 static const unsigned int prop = exp1::prop;
1672 :o1(o1),var_id(var_id)
1674 for (
int i = 0 ; i < n ; i++)
1675 {this->comp[i] = comp[i];}
1687 return o1.getGrid();
1699 return o1.getGrid();
1709 typedef typename boost::mpl::at<typename gtype::value_type::type,boost::mpl::int_<exp1::prop>>::type
property_act;
1753 return this->value(key,c_where);
1756 template<
typename Sys_eqs,
typename gmap_type,
typename unordered_map_type>
1757 inline void value_nz(
const gmap_type & g_map,
1760 typename Sys_eqs::stype (& spacing )[Sys_eqs::dims],
1761 unordered_map_type & cols,
1762 typename Sys_eqs::stype coeff,
1770 std::cout << __FILE__ <<
":" << __LINE__ <<
" Error it only work for tensore of rank 1 ... like vectors " << std::endl;
1775 o1.template value_nz<Sys_eqs>(g_map,key,gs,spacing,cols,coeff,comp_ + var_id + comp[0],c_where);
1778 inline grid_dist_expression_op<exp1,boost::mpl::int_<n+1>,g_comp> operator[](
int comp_)
1782 for (
int i = 0 ; i < n ; i++)
1783 {comp_n[i] = comp[i];}
1786 grid_dist_expression_op<exp1,boost::mpl::int_<n+1>,g_comp> v_exp(o1,comp_n,var_id);
1796 return this->value(key,c_where);
1811 auto & g = getGrid();
1813 auto it = g.getDomainIterator();
1820 auto key = it.get();
1841 auto & g = getGrid();
1843 auto it = g.getDomainIterator();
1850 auto key = it.get();
1869 auto & v = getGrid();
1871 auto it = v.getDomainIterator();
1875 auto key = it.get();
1899 template <
unsigned int prp,
typename gr
id>
inline grid_dist_expression<prp,grid,NORM_EXPRESSION> getV(
grid & g)
1901 grid_dist_expression<prp,grid,NORM_EXPRESSION> exp_g(g);
1912 template <
unsigned int prp,
typename gr
id>
inline grid_dist_expression<prp,grid,STAG_EXPRESSION> getV_stag(
grid & g)
1914 grid_dist_expression<prp,grid,STAG_EXPRESSION> exp_g(g);
1922 template<
unsigned int dim>
1931 bool is_equal = gdb_ext.
size() == tmp.gdb_ext.
size();
1933 for (
int i = 0 ; i < gdb_ext.
size() ; i++)
1935 is_equal &= gdb_ext.get(i) == tmp.gdb_ext.get(i);
1938 is_equal &= ginfo_v == tmp.ginfo_v;
1944 template<
unsigned int dim>
1959 static constexpr
unsigned int dims = dim;
1973 template<
unsigned int prp>
2036 size_t Nloc_grid = input.gdb_ext.
size();
2040 for (
int i = 0 ; i < Nloc_grid; i++)
2044 for (
int j = 0 ; j < dim ; j++) {sz[j] = input.gdb_ext.get(i).GDbox.getKP2().get(j) + 1;}
2049 gdb_ext = input.gdb_ext;
2054 decltype(device_grid::type_of_subiterator()),FREE> getIterator()
2062 decltype(device_grid::type_of_subiterator()),
2069 template<
typename patches>
2072 static constexpr
unsigned int dims = patches::dims;
2083 template<
unsigned int dim>
2094 typedef double type_proc;
2096 template<
typename super_general>
2097 void operator_equal(super_general & g_exp)
2101 resize(g_exp.getGrid());
2106 auto it = this->getVector().getIterator();
2110 auto key = it.get();
2112 data.loc_grid.get(key.
getSub()).template get<0>(key.
getKey()) = g_exp.value(key,s_pos);
2120 static constexpr
unsigned int dims = dim;
2128 static const unsigned int prop = 0;
2139 template<
typename gr
id>
2145 template<
typename gr
id>
2146 void resize(
grid & g)
2148 size_t Nloc_grid = g.getN_loc_grid();
2150 data.loc_grid.resize(Nloc_grid);
2152 for (
int i = 0 ; i < Nloc_grid; i++)
2154 data.loc_grid.get(i).resize(g.get_loc_grid(i).getGrid().getSize());
2157 gdb_ext = g.getLocalGridsInfo();
2158 ginfo_v = g.getGridInfoVoid();
2161 grid_dist_expression_iterator_to_make_algebra_work<dim> getVector()
const
2163 return grid_dist_expression_iterator_to_make_algebra_work<dim>(data.loc_grid,gdb_ext,ginfo_v);
2207 return data.loc_grid.get(k.getSub()).template get<0>(k.getKey());
2232 return data.loc_grid.get(k.getSub()).template get<0>(k.getKey());
2244 operator_equal(g_exp);
2246 return g_exp.getGrid();
2258 operator_equal(g_exp);
2260 return g_exp.getGrid();
2268 return this->value(key,c_where);
2289 template<
unsigned int p1,
unsigned int p2,
typename g1,
typename g2,
unsigned int impl_p1,
unsigned int impl_p2>
2306 template<
typename exp1 ,
typename exp2,
typename op1,
unsigned int prp1,
typename g1,
unsigned int impl_p1>
2323 template<
typename exp1 ,
typename exp2,
typename op1,
unsigned int prp1,
typename g1,
unsigned int impl_p1>
2340 template<
typename exp1 ,
typename exp2,
typename op1,
typename exp3 ,
typename exp4,
typename op2>
2357 template<
unsigned int prp1 ,
typename g1,
unsigned int impl_p1>
2374 template<
unsigned int prp1 ,
typename g1,
unsigned int impl_p1>
2391 template<
typename exp1 ,
typename exp2,
typename op1>
2408 template<
unsigned int p1,
unsigned int p2,
typename g1,
typename g2,
unsigned int impl_p1,
unsigned int impl_p2>
2425 template<
typename exp1 ,
typename exp2,
typename op1,
unsigned int prp1,
typename g1,
unsigned int impl_p1>
2442 template<
typename exp1 ,
typename exp2,
typename op1,
unsigned int prp1,
typename g1,
unsigned int impl_p1>
2458 template<
typename exp1 ,
typename exp2_,
typename op1>
2467 template<
unsigned int prp1 ,
typename g1,
unsigned int impl_p1>
2485 template<
typename exp1 ,
typename exp2,
typename op1,
typename exp3 ,
typename exp4,
typename op2>
2502 template<
unsigned int prp1 ,
typename g1,
unsigned int impl_p1>
2519 template<
unsigned int prp1 ,
typename g1,
unsigned int impl_p1>
2536 template<
typename exp1 ,
typename exp2,
typename op1>
2553 template<
unsigned int p2,
typename g2,
unsigned int impl_p2>
2570 template<
unsigned int p2,
typename g2,
unsigned int impl_p2>
2587 template<
unsigned int p1,
typename v1,
unsigned int p2,
typename v2,
unsigned int impl_p1,
unsigned int impl_p2>
2604 template<
unsigned int p1,
typename v1,
typename exp1,
typename exp2,
typename op1,
unsigned int impl_p1>
2621 template<
unsigned int p1,
typename v1,
typename exp1,
typename exp2,
typename op1,
unsigned int impl_p1>
2638 template<
typename exp1,
typename exp2,
typename op1,
typename exp3 ,
typename exp4,
typename op2>
2655 template<
typename exp1 ,
typename exp2,
typename op1>
2672 template<
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.
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 > getGrid()
Return the grid on which is acting.
grid_dist_expression(grid &g)
constructor for an external grid
const grid_dist_expression_iterator_to_make_algebra_work< dim > getGrid() const
Return the grid on which is acting.
grid_sm< dim, void > ginfo_v
Grid informations object without type.
const grid & operator=(const grid_dist_expression< prp2, grid, NORM_EXPRESSION > &g_exp)
Fill the grid property with the evaluated 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_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 & operator=(const grid_dist_expression< prp2, grid_type, NORM_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 -> 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.
const grid & getGrid() const
Return the grid on which is acting.
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_op< exp1, exp2, op > &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.
grid & getGrid()
Return the grid on which is acting.
grid gtype
The type of the internal grid.
void init() const
This function must be called before value.
const grid & getGrid() const
Return the grid on which is acting.
grid gtype
The type of the internal grid.
grid & operator=(double d)
Fill the grid property with the double.
grid & operator=(const grid_dist_expression< prp2, grid, STAG_EXPRESSION > &g_exp)
Fill the grid property with the evaluated expression.
grid_dist_expression(grid &g)
constructor for an external grid
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 & operator=(const grid_dist_expression_op< exp1, exp2, op > &g_exp)
Fill the grid property with the evaluated expression.
grid & getGrid()
Return the grid on which is acting.
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.
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.
device_grid & get_loc_grid(size_t i)
Get the i sub-domain grid.
openfpm::vector< grid_cpu< dim, aggregate< double > > > & loc_grid
The grid.
const grid_sm< dim, void > & getGridInfoVoid() const
Get an object containing the grid informations without type.
size_t getN_loc_grid() const
Return the number of local grid.
grid_sm< dim, void > & ginfo_v
Grid informations object without type.
const openfpm::vector< GBoxes< device_grid::dims > > & getLocalGridsInfo() const
It return the informations about the local grids.
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.
gtype & operator=(const grid_dist_expression_op< exp1_, exp2_, op > &v_exp)
Fill the vector property with the evaluated expression.
void init() const
initialize the expression tree
boost::mpl::at< typename gtype::value_type::type, boost::mpl::int_< exp1::prop > >::type property_act
property on which this view 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=(double d)
Fill the vector property with the double.
gtype & getGrid()
Return the vector on which is acting.
grid_dist_expression_op(const exp1 &o1, int(&comp)[n], int var_id)
constructor from an expresssion
const gtype & getGrid() const
Return the vector on which is acting.
gtype & operator=(const grid_dist_expression< prp2, gtype2, impl > &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.
const gtype & getGrid() const
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.
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.
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.
gtype & getGrid()
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.
const gtype & getGrid() const
Return the grid on which is acting.
grid_dist_expression_op(const exp1 &o1)
Costruct a FD expression out of two expressions.
gtype & getGrid()
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.
base_key & getKeyRef()
Get the reference key.
size_t getSub() const
Get the local grid.
base_key getKey() const
Get the key.
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.
like std::rank but it also work for openfpm structures like Point where it return 1