Mentions légales du service

Skip to content
Snippets Groups Projects
Commit bda19ffc authored by Olivier COULAUD's avatar Olivier COULAUD
Browse files

Fix bug in the sign of the gradient.

parent 9a6c8dbb
No related branches found
No related tags found
No related merge requests found
...@@ -191,7 +191,7 @@ namespace scalfmm::matrix_kernels::laplace ...@@ -191,7 +191,7 @@ namespace scalfmm::matrix_kernels::laplace
/// grad_one_over_r\f$ k(x,y) : R -> R^{d}\f$ with \f$d \f$ the space /// grad_one_over_r\f$ k(x,y) : R -> R^{d}\f$ with \f$d \f$ the space
/// dimension. /// dimension.
/// ///
/// \f$k(x,y) = \grad | x - y |^{-1}\f$ /// \f$k(x,y) = \grad | x - y |^{-1} = -(x-y) | x - y |^{-3}\f$
/// ///
/// scale factor \f$k(ax,ay)= 1/a^2 k(x,y)\f$ /// scale factor \f$k(ax,ay)= 1/a^2 k(x,y)\f$
template<std::size_t Dim = 3> template<std::size_t Dim = 3>
...@@ -242,7 +242,7 @@ namespace scalfmm::matrix_kernels::laplace ...@@ -242,7 +242,7 @@ namespace scalfmm::matrix_kernels::laplace
using std::sqrt; using std::sqrt;
ValueType tmp = ValueType(1.0) / sqrt((((xs.at(Is) - ys.at(Is)) * (xs.at(Is) - ys.at(Is))) + ...)); ValueType tmp = ValueType(1.0) / sqrt((((xs.at(Is) - ys.at(Is)) * (xs.at(Is) - ys.at(Is))) + ...));
ValueType r3{pow(tmp, int(3))}; ValueType r3{pow(tmp, int(3))};
return std::make_tuple((r3 * (xs.at(Is) - ys.at(Is)))...); return std::make_tuple((r3 * (ys.at(Is) - xs.at(Is)))...);
//-r3 * (xs - ys); //-r3 * (xs - ys);
} }
...@@ -257,6 +257,8 @@ namespace scalfmm::matrix_kernels::laplace ...@@ -257,6 +257,8 @@ namespace scalfmm::matrix_kernels::laplace
/// val_grad_one_over_r \f$k(x,y) : R^{km} -> R^{kn}\f$ with \f$ km = 1\f$ and \f$kn = d+1\f$ with \f$ d\f$ the /// val_grad_one_over_r \f$k(x,y) : R^{km} -> R^{kn}\f$ with \f$ km = 1\f$ and \f$kn = d+1\f$ with \f$ d\f$ the
/// space dimension. /// space dimension.
/// ///
/// \f$k(x,y) = ( | x - y |^{-1}, \grad | x - y |^{-1} ) =(| x - y |^{-1}, -(x-y) | x - y |^{-3}\f)$
///
/// Is a specific kernel used to compute the value of the kernel and its gradient /// Is a specific kernel used to compute the value of the kernel and its gradient
/// ///
/// scale factor \f$ k(ax,ay)= (1/a, 1/a^2 ... 1/a^2) k(x,y)\f$ /// scale factor \f$ k(ax,ay)= (1/a, 1/a^2 ... 1/a^2) k(x,y)\f$
...@@ -302,7 +304,7 @@ namespace scalfmm::matrix_kernels::laplace ...@@ -302,7 +304,7 @@ namespace scalfmm::matrix_kernels::laplace
using std::sqrt; using std::sqrt;
ValueType tmp = ValueType(1.0) / sqrt((((xs.at(Is) - ys.at(Is)) * (xs.at(Is) - ys.at(Is))) + ...)); ValueType tmp = ValueType(1.0) / sqrt((((xs.at(Is) - ys.at(Is)) * (xs.at(Is) - ys.at(Is))) + ...));
ValueType r3{pow(tmp, int(3))}; ValueType r3{pow(tmp, int(3))};
return std::make_tuple(tmp, (r3 * (xs.at(Is) - ys.at(Is)))...); //-r3 * (xs - ys); return std::make_tuple(tmp, (r3 * (ys.at(Is) - xs.at(Is)))...); //-r3 * (xs - ys);
} }
const std::size_t separation_criterion{1}; const std::size_t separation_criterion{1};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment