From 908c1dfbd41a1bfe2210e3cfba0e41fda0940371 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Mon, 23 Mar 2020 16:01:56 +0100 Subject: Add some structure to view implementation --- kernel.cl | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'kernel.cl') diff --git a/kernel.cl b/kernel.cl index 8bbe28a..0a8056b 100644 --- a/kernel.cl +++ b/kernel.cl @@ -108,22 +108,18 @@ __kernel void evolve(__global vec_t* pos_a, pos_b[i] = p; vel_b[i] = v; } else { - vec_t p_ = pos_a[jParticle]; - vec_t v_ = vel_a[jParticle]; - - p += min2intersect * v; - p_ += min2intersect * v_; + if (i < jParticle) { + vec_t p_ = pos_a[jParticle]; + vec_t v_ = vel_a[jParticle]; - vec_t omega = normalize(p - p_); + p += min2intersect * v; + p_ += min2intersect * v_; - while (dot(omega,omega) < 1.0) { - omega *= 1.001; - } + vec_t omega = normalize(p - p_); - v -= dot(vel_a[i] - vel_a[jParticle], omega) * omega; - v_ -= dot(vel_a[jParticle] - vel_a[i], omega) * omega; + v -= dot(vel_a[i] - vel_a[jParticle], omega) * omega; + v_ -= dot(vel_a[jParticle] - vel_a[i], omega) * omega; - if (i < jParticle) { p += (DELTA_T - min2intersect) * v; p_ += (DELTA_T - min2intersect) * v_; -- cgit v1.2.3