tfix distance calculation - sphere - GPU-based 3D discrete element method algor… | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 8028d0a469cceaa3de99de5bd9ecf1bccc0e2317 | |
parent d91d2b6dfe2aeff630816a5d527690c7747d9797 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Thu, 19 Mar 2015 13:46:24 +0100 | |
fix distance calculation | |
Diffstat: | |
M src/darcy.cuh | 6 +++--- | |
1 file changed, 3 insertions(+), 3 deletions(-) | |
--- | |
diff --git a/src/darcy.cuh b/src/darcy.cuh | |
t@@ -285,9 +285,9 @@ __device__ Float weight( | |
const Float dy, // in: Cell spacing, y | |
const Float dz) // in: Cell spacing, z | |
{ | |
- const Float x_len = length(x_p - x_f); | |
- if (x_len.x < dx && x_len.y < dy && x_len.z < dz) | |
- return (1.0 - x_len.x/dx)*(1.0 - x_len.y/dy)*(1.0 - x_len.z/dz); | |
+ const Float3 dist = abs(x_p - x_f); | |
+ if (dist.x < dx && dist.y < dy && dist.z < dz) | |
+ return (1.0 - dist.x/dx)*(1.0 - dist.y/dy)*(1.0 - dist.z/dz); | |
else | |
return 0.0; | |
} |