aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-05-28 18:24:21 +0200
committerAdrian Kummerlaender2019-05-28 18:24:21 +0200
commit564606b8b64d9c406986ee2ca3dcdf4ea58b68f0 (patch)
tree3a8db90ac6a9e0c4f9aa5ba410cef1cf9f6e0428
parentccd0fc6bb23dd3b98961ffb3a3cb396261192926 (diff)
downloadsymlbm_playground-564606b8b64d9c406986ee2ca3dcdf4ea58b68f0.tar
symlbm_playground-564606b8b64d9c406986ee2ca3dcdf4ea58b68f0.tar.gz
symlbm_playground-564606b8b64d9c406986ee2ca3dcdf4ea58b68f0.tar.bz2
symlbm_playground-564606b8b64d9c406986ee2ca3dcdf4ea58b68f0.tar.lz
symlbm_playground-564606b8b64d9c406986ee2ca3dcdf4ea58b68f0.tar.xz
symlbm_playground-564606b8b64d9c406986ee2ca3dcdf4ea58b68f0.tar.zst
symlbm_playground-564606b8b64d9c406986ee2ca3dcdf4ea58b68f0.zip
Add const qualifiers for pointers
-rw-r--r--implosion.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/implosion.py b/implosion.py
index 8e75921..212fbcd 100644
--- a/implosion.py
+++ b/implosion.py
@@ -31,7 +31,7 @@ unsigned int indexOfDirection(int i, int j) {
return 3*(i+1) + (j+1);
}
-float pop(__global float* cell, int i, int j) {
+float pop(__global const float* cell, int i, int j) {
return cell[indexOfDirection(i,j)];
}
@@ -47,7 +47,7 @@ float norm(float2 v) {
return sqrt(dot(v,v));
}
-float density(__global float* cell) {
+float density(__global const float* cell) {
float d = 0.;
for ( int i = 0; i < 9; ++i ) {
d += cell[i];
@@ -55,7 +55,7 @@ float density(__global float* cell) {
return d;
}
-float2 velocity(__global float* cell, float d)
+float2 velocity(__global const float* cell, float d)
{
return (float2)(
(pop(cell,1,0) - pop(cell,-1,0) + pop(cell,1,1) - pop(cell,-1,-1) + pop(cell,1,-1) - pop(cell,-1,1)) / d,
@@ -68,8 +68,8 @@ float equilibrium(float d, float2 v, int i, int j) {
}
__kernel void collide_and_stream(__global float* pop_a,
- __global float* pop_b,
- __global int* material)
+ __global const float* pop_b,
+ __global const int* material)
{
const unsigned int gid = get_global_id(0);
const uint2 cell = cellAtGid(gid);