tfixed findDistMod function to allow search across periodic boundaries of more … | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit aed17f7c9168b1125b0334b6039383407f843718 | |
parent 57d9c42669af9eb387f3053f3176a5ea9c3e4db4 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Wed, 30 Apr 2014 11:47:53 +0200 | |
fixed findDistMod function to allow search across periodic boundaries of more t… | |
Diffstat: | |
M CMakeLists.txt | 10 +++++----- | |
M src/contactsearch.cuh | 31 ++++++++++++++++++-----------… | |
M src/navierstokes.cuh | 1 + | |
3 files changed, 24 insertions(+), 18 deletions(-) | |
--- | |
diff --git a/CMakeLists.txt b/CMakeLists.txt | |
t@@ -29,13 +29,13 @@ find_package(OpenMP) | |
enable_testing() | |
# Set build type = Debug | |
-#set(CMAKE_BUILD_TYPE Debug) | |
-#if (CUDA_FOUND) | |
-# set(CUDA_NVCC_FLAGS -g;-G) | |
-#endif() | |
+set(CMAKE_BUILD_TYPE Debug) | |
+if (CUDA_FOUND) | |
+ set(CUDA_NVCC_FLAGS -g;-G) | |
+endif() | |
# Set build type = Release | |
-set(CMAKE_BUILD_TYPE Release) | |
+#set(CMAKE_BUILD_TYPE Release) | |
# Add source directory to project. | |
add_subdirectory(src) | |
diff --git a/src/contactsearch.cuh b/src/contactsearch.cuh | |
t@@ -18,21 +18,25 @@ __device__ int findDistMod(int3* targetCell, Float3* distm… | |
// Periodic x-boundary | |
if (targetCell->x < 0) { | |
- targetCell->x = devC_grid.num[0] - 1; | |
+ //targetCell->x = devC_grid.num[0] - 1; | |
+ targetCell->x += devC_grid.num[0]; | |
*distmod += MAKE_FLOAT3(devC_grid.L[0], 0.0f, 0.0f); | |
} | |
- if (targetCell->x == devC_grid.num[0]) { | |
- targetCell->x = 0; | |
+ if (targetCell->x >= devC_grid.num[0]) { | |
+ //targetCell->x = 0; | |
+ targetCell->x -= devC_grid.num[0]; | |
*distmod -= MAKE_FLOAT3(devC_grid.L[0], 0.0f, 0.0f); | |
} | |
// Periodic y-boundary | |
if (targetCell->y < 0) { | |
- targetCell->y = devC_grid.num[1] - 1; | |
+ //targetCell->y = devC_grid.num[1] - 1; | |
+ targetCell->y += devC_grid.num[0]; | |
*distmod += MAKE_FLOAT3(0.0f, devC_grid.L[1], 0.0f); | |
} | |
- if (targetCell->y == devC_grid.num[1]) { | |
- targetCell->y = 0; | |
+ if (targetCell->y >= devC_grid.num[1]) { | |
+ //targetCell->y = 0; | |
+ targetCell->y -= devC_grid.num[1]; | |
*distmod -= MAKE_FLOAT3(0.0f, devC_grid.L[1], 0.0f); | |
} | |
t@@ -42,11 +46,13 @@ __device__ int findDistMod(int3* targetCell, Float3* distm… | |
// Periodic x-boundary | |
if (targetCell->x < 0) { | |
- targetCell->x = devC_grid.num[0] - 1; | |
+ //targetCell->x = devC_grid.num[0] - 1; | |
+ targetCell->x += devC_grid.num[0]; | |
*distmod += MAKE_FLOAT3(devC_grid.L[0], 0.0f, 0.0f); | |
} | |
- if (targetCell->x == devC_grid.num[0]) { | |
- targetCell->x = 0; | |
+ if (targetCell->x >= devC_grid.num[0]) { | |
+ //targetCell->x = 0; | |
+ targetCell->x -= devC_grid.num[0]; | |
*distmod -= MAKE_FLOAT3(devC_grid.L[0], 0.0f, 0.0f); | |
} | |
t@@ -66,11 +72,10 @@ __device__ int findDistMod(int3* targetCell, Float3* distm… | |
} | |
// Handle out-of-grid cases on z-axis | |
- if (targetCell->z < 0 || targetCell->z == devC_grid.num[2]) | |
+ if (targetCell->z < 0 || targetCell->z >= devC_grid.num[2]) | |
return -1; | |
- | |
- // Return successfully | |
- return 0; | |
+ else | |
+ return 0; | |
} | |
diff --git a/src/navierstokes.cuh b/src/navierstokes.cuh | |
t@@ -922,6 +922,7 @@ __global__ void findPorositiesVelocitiesDiametersSpherical( | |
// Iterate over 27 neighbor cells, R = 2*cell width | |
for (int z_dim=-2; z_dim<3; ++z_dim) { // z-axis | |
+ //for (int z_dim=-1; z_dim<2; ++z_dim) { // z-axis | |
for (int y_dim=-2; y_dim<3; ++y_dim) { // y-axis | |
for (int x_dim=-2; x_dim<3; ++x_dim) { // x-axis | |