OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
Avg< d, arg, Sys_eqs, BACKWARD > Class Template Reference

First order BACKWARD derivative on direction i. More...

Detailed Description

template<unsigned int d, typename arg, typename Sys_eqs>
class Avg< d, arg, Sys_eqs, BACKWARD >

First order BACKWARD derivative on direction i.

*
*  +0.5    0.5
*    *------+
*
* 

Definition at line 213 of file Average.hpp.

#include <Average.hpp>

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...
 
static grid_key_dx< Sys_eqs::dims > position (grid_key_dx< Sys_eqs::dims > &pos, const grid_sm< Sys_eqs::dims, void > &gs, const comb< Sys_eqs::dims >(&s_pos)[Sys_eqs::nvar])
 Calculate the position in the cell where the average is calculated. More...
 

Member Function Documentation

template<unsigned int d, typename arg , typename Sys_eqs >
static grid_key_dx<Sys_eqs::dims> Avg< d, arg, Sys_eqs, BACKWARD >::position ( grid_key_dx< Sys_eqs::dims > &  pos,
const grid_sm< Sys_eqs::dims, void > &  gs,
const comb< Sys_eqs::dims >(&)  s_pos[Sys_eqs::nvar] 
)
inlinestatic

Calculate the position in the cell where the average is calculated.

In case of non staggered case this function just return a null grid_key, in case of staggered, the BACKWARD scheme return the position of the staggered property

Parameters
posposition where we are calculating the derivative
gsGrid info
s_posstaggered position of the properties

Definition at line 255 of file Average.hpp.

template<unsigned int d, typename arg , typename Sys_eqs >
static void Avg< d, arg, Sys_eqs, BACKWARD >::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.

stub_or_real it is just for change the argument type when testing, in normal conditions it is a distributed map

Parameters
g_mapIt is the map explained in FDScheme
kmapposition where the average is calculated
gsGrid info
colsnon-zero colums calculated by the function
coeffcoefficent (constant in front of the derivative)

Example

// grid size
size_t sz[2]={16,16};
// grid_dist_testing
// grid_sm
grid_sm<2,void> ginfo(sz);
// spacing
float spacing[2] = {0.5,0.3};
// Create several keys
// filled colums
std::unordered_map<long int,float> cols_x;
std::unordered_map<long int,float> cols_y;
D<x,Field<V,sys_nn>,sys_nn>::value(g_map,key11,ginfo,spacing,cols_x,1);
D<y,Field<V,sys_nn>,sys_nn>::value(g_map,key11,ginfo,spacing,cols_y,1);
BOOST_REQUIRE_EQUAL(cols_x.size(),2ul);
BOOST_REQUIRE_EQUAL(cols_y.size(),2ul);
BOOST_REQUIRE_EQUAL(cols_x[17+1],1/spacing[0]/2.0);
BOOST_REQUIRE_EQUAL(cols_x[17-1],-1/spacing[0]/2.0);
BOOST_REQUIRE_EQUAL(cols_y[17+16],1/spacing[1]/2.0);
BOOST_REQUIRE_EQUAL(cols_y[17-16],-1/spacing[1]/2.0);

Definition at line 233 of file Average.hpp.


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