------------------------------------------------------------ revno: 3506 committer: Anton Gladky <gladky.an...@gmail.com> timestamp: Fri 2014-10-24 10:50:30 +0200 message: Simplify Lucy kernel function modified: pkg/common/SPHEngine.cpp
-- lp:yade https://code.launchpad.net/~yade-pkg/yade/git-trunk Your team Yade developers is subscribed to branch lp:yade. To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'pkg/common/SPHEngine.cpp' --- pkg/common/SPHEngine.cpp 2014-10-24 08:39:43 +0000 +++ pkg/common/SPHEngine.cpp 2014-10-24 08:50:30 +0000 @@ -55,7 +55,8 @@ Real smoothkernelLucy(const double & r, const double & h) { if (r<=h && h>0) { // Lucy Kernel function, [Lucy1977] (27) - return 105./(16.*M_PI*h*h*h) * (1 + 3 * r / h) * pow((1.0 - r / h), 3); + const Real r_h = r / h; + return 105./(16.*M_PI*h*h*h) * (1 + 3 * r_h) * pow((1.0 - r_h), 3); } else { return 0; } @@ -64,7 +65,7 @@ Real smoothkernelLucyGrad(const double & r, const double & h) { if (r<=h && h>0) { // 1st derivative of Lucy Kernel function, [Lucy1977] (27) - return 105./(16.*M_PI*h*h*h) * (-12 * r) * (1/( h * h ) - 2 * r / (h * h * h ) + r * r / (h * h * h * h)); + return 105./(16.*M_PI*h*h*h) * (-12 * r) * pow((h - r), 2) / ( h * h * h * h ); } else { return 0; }
_______________________________________________ Mailing list: https://launchpad.net/~yade-dev Post to : yade-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-dev More help : https://help.launchpad.net/ListHelp