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

Laplacian second order approximation CENTRAL Scheme (with central derivative in the single) More...

Detailed Description

template<typename arg, typename Sys_eqs>
class Lap< arg, Sys_eqs, CENTRAL_SYM >

Laplacian second order approximation CENTRAL Scheme (with central derivative in the single)

         1.0
          *
          | -4.0
  1.0 *---+---* 1.0
          |
          *
         1.0

* 

Definition at line 133 of file Laplacian.hpp.

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

Member Function Documentation

template<typename arg , typename Sys_eqs >
static void Lap< arg, Sys_eqs, CENTRAL_SYM >::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_mapmap grid
kmapposition in the grid
spacingof the grid
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_sm
grid_sm<2,void> ginfo(sz);
// spacing
float spacing[2] = {0.5,0.3};
// grid_dist_testing
// Create several keys
// filled colums
std::unordered_map<long int,float> cols;
Lap<Field<V,sys_pp>,sys_pp>::value(g_map,key11,ginfo,spacing,cols,1);
BOOST_REQUIRE_EQUAL(cols.size(),5ul);
BOOST_REQUIRE_EQUAL(cols[1],1/spacing[1]/spacing[1]);
BOOST_REQUIRE_EQUAL(cols[17-1],1/spacing[0]/spacing[0]);
BOOST_REQUIRE_EQUAL(cols[17+1],1/spacing[0]/spacing[0]);
BOOST_REQUIRE_EQUAL(cols[17+16],1/spacing[1]/spacing[1]);
BOOST_REQUIRE_EQUAL(cols[17],-2/spacing[0]/spacing[0] - 2/spacing[1]/spacing[1]);

Definition at line 155 of file Laplacian.hpp.


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