OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
sum< expr > Struct Template Reference

It model an expression expr1 + ... exprn. More...

Detailed Description

template<typename... expr>
struct sum< expr >

It model an expression expr1 + ... exprn.

Template Parameters
expr..two or more expression to be summed
Sys_eqsstystem specification

Example

// grid size
size_t sz[2]={16,16};
// spacing
float spacing[2] = {0.5,0.3};
// grid_sm
grid_sm<2,void> ginfo(sz);
// grid_dist_testing
// Create several keys
// filled colums
std::unordered_map<long int,float> cols;
sum<Field<V,sys_pp>,Field<V,sys_pp>,sys_pp>::value(g_map,key11,ginfo,spacing,cols,1);
BOOST_REQUIRE_EQUAL(cols.size(),1ul);
BOOST_REQUIRE_EQUAL(cols[17],2);

Definition at line 92 of file sum.hpp.

#include <sum.hpp>

Public Types

typedef boost::mpl::vector
< expr... > 
v_expr
 Transform from variadic template to boost mpl vector.
 
typedef boost::mpl::size
< v_expr >::type 
v_sz
 size of v_expr
 
typedef boost::mpl::at< v_expr,
boost::mpl::int_
< v_sz::type::value-1 >
>::type 
Sys_eqs
 struct that specify the syste, of equations
 

Static Public Member Functions

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. More...
 

Member Function Documentation

template<typename... expr>
static void sum< expr >::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 
)
inlinestatic

Calculate which colums of the Matrix are non zero.

Parameters
g_mapGrid mapping, it convert grid position into vector/Matrix row
kmapgrid position
gsgrid information
spacinggrid spacing
colsunordered map contain the map colum -> value
coeffit contain an additional actual coefficients in front of the values

Example

// grid size
size_t sz[2]={16,16};
// spacing
float spacing[2] = {0.5,0.3};
// grid_sm
grid_sm<2,void> ginfo(sz);
// grid_dist_testing
// Create several keys
// filled colums
std::unordered_map<long int,float> cols;
sum<Field<V,sys_pp>,Field<V,sys_pp>,sys_pp>::value(g_map,key11,ginfo,spacing,cols,1);
BOOST_REQUIRE_EQUAL(cols.size(),1ul);
BOOST_REQUIRE_EQUAL(cols[17],2);

Definition at line 117 of file sum.hpp.


The documentation for this struct was generated from the following file: