OpenFPM  5.2.0
Project that contain the implementation of distributed structures
sum< expr > Struct Template Reference

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

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

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: eq.hpp:83
Grid key for a distributed grid.
grid_key_dx is the key to access any element in the grid
Definition: grid_key.hpp:19
Declaration grid_sm.
Definition: grid_sm.hpp:167
It model an expression expr1 + ... exprn.
Definition: sum.hpp:93
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.
Definition: sum.hpp:117

Definition at line 92 of file sum.hpp.

Member Function Documentation

◆ value()

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: