aboutsummaryrefslogtreecommitdiff
path: root/template
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-09-04 22:52:38 +0200
committerAdrian Kummerlaender2019-09-04 22:52:38 +0200
commit4974c2ccc7f640d6a657c22cc1a3dfa9d114b8f0 (patch)
tree22a4376485604e3483b4ee044ca5460bd4f27867 /template
parenta89d3eba9aec11a4f55817fcdb189fcd6f26b574 (diff)
downloadsymlbm_playground-4974c2ccc7f640d6a657c22cc1a3dfa9d114b8f0.tar
symlbm_playground-4974c2ccc7f640d6a657c22cc1a3dfa9d114b8f0.tar.gz
symlbm_playground-4974c2ccc7f640d6a657c22cc1a3dfa9d114b8f0.tar.bz2
symlbm_playground-4974c2ccc7f640d6a657c22cc1a3dfa9d114b8f0.tar.lz
symlbm_playground-4974c2ccc7f640d6a657c22cc1a3dfa9d114b8f0.tar.xz
symlbm_playground-4974c2ccc7f640d6a657c22cc1a3dfa9d114b8f0.tar.zst
symlbm_playground-4974c2ccc7f640d6a657c22cc1a3dfa9d114b8f0.zip
Reset stuck particles to starting position
Diffstat (limited to 'template')
-rw-r--r--template/kernel.mako10
1 files changed, 8 insertions, 2 deletions
diff --git a/template/kernel.mako b/template/kernel.mako
index f6bac7f..1ee39cd 100644
--- a/template/kernel.mako
+++ b/template/kernel.mako
@@ -140,6 +140,7 @@ __kernel void collect_gl_moments(__global __read_only ${float_type}* f,
}
__kernel void update_particles(__global __read_only float4* moments,
+ __global __read_only int* material,
__global __write_only float4* particles)
{
const unsigned int pid = get_global_id(0);
@@ -150,8 +151,13 @@ __kernel void update_particles(__global __read_only float4* moments,
float4 moment = moments[gid];
- particle.x += moment.y;
- particle.y += moment.z;
+ if (material[gid] == 1) {
+ particle.x += moment.y;
+ particle.y += moment.z;
+ } else {
+ particle.x = particle.z;
+ particle.y = particle.w;
+ }
particles[pid] = particle;
}