Commit 5106ef95 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Do not compute the high-order softened derivatives as the resulting term is 0 anyway.

parent 37b66011
......@@ -170,14 +170,14 @@ __attribute__((always_inline)) INLINE static void kernel_grav_eval_force_double(
__attribute__((always_inline)) INLINE static float D_soft_1(float u,
float u_inv) {
/* phi(u) = -3u^7 + 15u^6 - 28u^5 + 21u^4 - 7u^2 + 3 */
float phi = -3.f * u + 15.f;
phi = phi * u - 28.f;
phi = phi * u + 21.f;
/* phi(u) = 3u^7 - 15u^6 + 28u^5 - 21u^4 + 7u^2 - 3 */
float phi = 3.f * u - 15.f;
phi = phi * u + 28.f;
phi = phi * u - 21.f;
phi = phi * u;
phi = phi * u - 7.f;
phi = phi * u + 7.f;
phi = phi * u;
phi = phi * u + 3.f;
phi = phi * u - 3.f;
return phi;
}
......@@ -198,43 +198,27 @@ __attribute__((always_inline)) INLINE static float D_soft_3(float u,
__attribute__((always_inline)) INLINE static float D_soft_5(float u,
float u_inv) {
/* (phi'(u)/u)'/u = -105u^3 + 360u^2 - 420u + 168 */
float phi = -105.f * u + 360.f;
phi = phi * u - 420.f;
phi = phi * u + 168.f;
/* (phi'(u)/u)'/u = 105u^3 - 360u^2 + 420u - 168 */
float phi = 105.f * u - 360.f;
phi = phi * u + 420.f;
phi = phi * u - 168.f;
return phi;
}
__attribute__((always_inline)) INLINE static float D_soft_7(float u,
float u_inv) {
/* ((phi'(u)/u)'/u)'/u = 315u - 720 + 420u^-1 */
return 315.f * u - 720.f + 420.f * u_inv;
return 0.f;
}
__attribute__((always_inline)) INLINE static float D_soft_9(float u,
float u_inv) {
/* (((phi'(u)/u)'/u)'/u)'/u = -315u^-1 + 420u^-3 */
float phi = 420.f * u_inv;
phi = phi * u_inv - 315.f;
phi = phi * u_inv;
return phi;
return 0.f;
}
__attribute__((always_inline)) INLINE static float D_soft_11(float u,
float u_inv) {
/* ((((phi'(u)/u)'/u)'/u)'/u)'/u = 315u^-3 - 1260u^-5 */
float phi = -1260.f * u_inv;
phi = phi * u_inv + 315.f;
phi = phi * u_inv;
phi = phi * u_inv;
phi = phi * u_inv;
return phi;
return 0.f;
}
#endif /* SWIFT_KERNEL_GRAVITY_H */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment