8 #ifndef OPENFPM_NUMERICS_SRC_FINITEDIFFERENCE_SUM_HPP_
9 #define OPENFPM_NUMERICS_SRC_FINITEDIFFERENCE_SUM_HPP_
11 #include <boost/mpl/vector.hpp>
13 #include <unordered_map>
14 #include "util/for_each_ref.hpp"
21 template<
typename v_expr>
25 typedef boost::mpl::size<v_expr>
size;
28 typedef typename boost::mpl::at<v_expr,boost::mpl::int_<size::value-1> >::type
last;
31 std::unordered_map<long int,typename last::stype> &
cols;
46 typename last::stype (&
spacing)[last::dims];
62 typename last::stype (&
spacing)[last::dims],
63 std::unordered_map<long int,typename last::stype> &
cols,
64 typename last::stype
coeff)
91template<
typename ... expr>
95 typedef boost::mpl::vector<expr... >
v_expr;
98 typedef typename boost::mpl::size<v_expr>::type
v_sz;
101 typedef typename boost::mpl::at<
v_expr, boost::mpl::int_<v_sz::type::value - 1> >::type
Sys_eqs;
120 typename Sys_eqs::stype (& spacing )[Sys_eqs::dims],
121 std::unordered_map<long int,typename Sys_eqs::stype > & cols,
122 typename Sys_eqs::stype coeff)
128 boost::mpl::for_each_ref< boost::mpl::range_c<int,0,v_sz::type::value - 1> >(sm);
140template<
typename arg,
typename Sys_eqs>
160 typename Sys_eqs::stype (& spacing )[Sys_eqs::dims],
161 std::unordered_map<long int,typename Sys_eqs::stype > & cols,
162 typename Sys_eqs::stype coeff)
164 arg::value(g_map,kmap,gs,spacing,cols,-coeff);
Grid key for a distributed grid.
It ancapsulate the minus operation.
static void value(const typename stub_or_real< Sys_eqs, Sys_eqs::dims, typename Sys_eqs::stype, typename Sys_eqs::b_grid::decomposition::extended_type >::type &g_map, grid_dist_key_dx< Sys_eqs::dims > &kmap, const grid_sm< Sys_eqs::dims, void > &gs, typename Sys_eqs::stype(&spacing)[Sys_eqs::dims], std::unordered_map< long int, typename Sys_eqs::stype > &cols, typename Sys_eqs::stype coeff)
Create the row of the Matrix.
grid_dist_key_dx< last::dims > & kmap
grid position
last::stype(& spacing)[last::dims]
spacing
boost::mpl::at< v_expr, boost::mpl::int_< size::value-1 > >::type last
Last element of sum.
void operator()(T &t) const
It call this function for every expression operand in the sum.
const stub_or_real< last, last::dims, typenamelast::stype, typenamelast::b_grid::decomposition::extended_type >::type & g_map
grid mapping
const grid_sm< last::dims, void > & gs
Grid info.
std::unordered_map< long int, typename last::stype > & cols
sum functor
boost::mpl::size< v_expr > size
Number of elements in the vector v_expr.
sum_functor_value(const typename stub_or_real< last, last::dims, typename last::stype, typename last::b_grid::decomposition::extended_type >::type &g_map, grid_dist_key_dx< last::dims > &kmap, const grid_sm< last::dims, void > &gs, typename last::stype(&spacing)[last::dims], std::unordered_map< long int, typename last::stype > &cols, typename last::stype coeff)
constructor
last::stype coeff
coefficent
It model an expression expr1 + ... exprn.
boost::mpl::at< v_expr, boost::mpl::int_< v_sz::type::value-1 > >::type Sys_eqs
struct that specify the syste, of equations
boost::mpl::size< v_expr >::type v_sz
size of v_expr
static void value(const typename stub_or_real< Sys_eqs, Sys_eqs::dims, typename Sys_eqs::stype, typename Sys_eqs::b_grid::decomposition::extended_type >::type &g_map, grid_dist_key_dx< Sys_eqs::dims > &kmap, const grid_sm< Sys_eqs::dims, void > &gs, typename Sys_eqs::stype(&spacing)[Sys_eqs::dims], std::unordered_map< long int, typename Sys_eqs::stype > &cols, typename Sys_eqs::stype coeff)
Calculate which colums of the Matrix are non zero.
boost::mpl::vector< expr... > v_expr
Transform from variadic template to boost mpl vector.