8#ifndef OPENFPM_NUMERICS_SRC_FINITEDIFFERENCE_LAPLACIAN_HPP_
9#define OPENFPM_NUMERICS_SRC_FINITEDIFFERENCE_LAPLACIAN_HPP_
11#include "FD_util_include.hpp"
12#include "util/util_num.hpp"
13#include "FiniteDifference/eq.hpp"
21template<
typename arg,
typename Sys_eqs,
unsigned int impl=CENTRAL>
44 std::unordered_map<long int,typename Sys_eqs::stype > & cols,
45 typename Sys_eqs::stype coeff)
47 std::cerr <<
"Error " << __FILE__ <<
":" << __LINE__ <<
" only CENTRAL, FORWARD, BACKWARD derivative are defined";
67template<
typename arg,
typename Sys_eqs>
68class Lap<arg,Sys_eqs,CENTRAL>
93 typename Sys_eqs::stype (& spacing )[Sys_eqs::dims] ,
94 std::unordered_map<long int,typename Sys_eqs::stype > & cols,
95 typename Sys_eqs::stype coeff)
98 for (
size_t i = 0 ; i < Sys_eqs::dims ; i++)
100 long int old_val = kmap.
getKeyRef().get(i);
102 arg::value(g_map,kmap,gs,spacing,cols,coeff/spacing[i]/spacing[i]);
107 arg::value(g_map,kmap,gs,spacing,cols,coeff/spacing[i]/spacing[i]);
110 arg::value(g_map,kmap,gs,spacing,cols, - 2.0 * coeff/spacing[i]/spacing[i]);
132template<
typename arg,
typename Sys_eqs>
133class Lap<arg,Sys_eqs,CENTRAL_SYM>
155 inline 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)
158 for (
size_t i = 0 ; i < Sys_eqs::dims ; i++)
160 long int old_val = kmap.
getKeyRef().get(i);
162 arg::value(g_map,kmap,gs,spacing,cols,coeff/spacing[i]/spacing[i]/4.0);
167 arg::value(g_map,kmap,gs,spacing,cols,coeff/spacing[i]/spacing[i]/4.0);
170 arg::value(g_map,kmap,gs,spacing,cols, - 2.0 * coeff/spacing[i]/spacing[i]/4.0);
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.
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.
Laplacian second order on h (spacing)
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, std::unordered_map< long int, typename Sys_eqs::stype > &cols, typename Sys_eqs::stype coeff)
Calculate which colums of the Matrix are non zero.
Grid key for a distributed grid.
base_key & getKeyRef()
Get the reference key.