tutility functions split into header and definition file - sphere - GPU-based 3D discrete element method algorithm with optional fluid coupling
(HTM) git clone git://src.adamsgaard.dk/sphere
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 4324e1882e6d7b28e495016df823e4e9130f2d75
(DIR) parent 819e1feb3c46bdb460501c4f73743ec7a9b5682c
(HTM) Author: Anders Damsgaard <adc@geo.au.dk>
Date: Wed, 12 Jun 2013 12:37:52 +0200
utility functions split into header and definition file
Diffstat:
M src/CMakeLists.txt | 8 ++++----
M src/darcy.cpp | 8 --------
A src/utility.cpp | 17 +++++++++++++++++
M src/utility.cu | 5 -----
M src/utility.h | 13 +++----------
5 files changed, 24 insertions(+), 27 deletions(-)
---
(DIR) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
t@@ -17,13 +17,13 @@ SET(CUDA_NVCC_FLAGS
# Rule to build executable program
CUDA_ADD_EXECUTABLE(../sphere
- main.cpp file_io.cpp sphere.cpp device.cu utility.cu darcy.cpp)
+ main.cpp file_io.cpp sphere.cpp device.cu utility.cu utility.cpp darcy.cpp)
CUDA_ADD_EXECUTABLE(../porosity
- porosity.cpp file_io.cpp sphere.cpp device.cu utility.cu darcy.cpp)
+ porosity.cpp file_io.cpp sphere.cpp device.cu utility.cu utility.cpp darcy.cpp)
CUDA_ADD_EXECUTABLE(../forcechains
- forcechains.cpp file_io.cpp sphere.cpp device.cu utility.cu darcy.cpp)
+ forcechains.cpp file_io.cpp sphere.cpp device.cu utility.cu utility.cpp darcy.cpp)
CUDA_ADD_EXECUTABLE(../porousflow
- porousflow.cpp darcy.cpp file_io.cpp sphere.cpp device.cu utility.cu)
+ porousflow.cpp darcy.cpp file_io.cpp sphere.cpp device.cu utility.cpp utility.cu)
#ADD_EXECUTABLE(unittests boost-unit-tests.cpp sphere.cpp)
#TARGET_LINK_LIBRARIES(unittests
(DIR) diff --git a/src/darcy.cpp b/src/darcy.cpp
t@@ -37,14 +37,6 @@ void DEM::freeDarcyMem()
free(d_n);
}
-// Swap two arrays pointers
-void swapFloatArrays(Float* arr1, Float* arr2)
-{
- Float* tmp = arr1;
- arr1 = arr2;
- arr2 = tmp;
-}
-
// 3D index to 1D index
unsigned int DEM::idx(
const unsigned int x,
(DIR) diff --git a/src/utility.cpp b/src/utility.cpp
t@@ -0,0 +1,17 @@
+// MISC. UTILITY FUNCTIONS
+
+#include "datatypes.h"
+
+
+//Round a / b to nearest higher integer value
+unsigned int iDivUp(unsigned int a, unsigned int b) {
+ return (a % b != 0) ? (a / b + 1) : (a / b);
+}
+
+// Swap two arrays pointers
+void swapFloatArrays(Float* arr1, Float* arr2)
+{
+ Float* tmp = arr1;
+ arr1 = arr2;
+ arr2 = tmp;
+}
(DIR) diff --git a/src/utility.cu b/src/utility.cu
t@@ -27,9 +27,4 @@ void checkForCudaErrors(const char* checkpoint_description, const unsigned int i
}
}
-//Round a / b to nearest higher integer value
-unsigned int iDivUp(unsigned int a, unsigned int b) {
- return (a % b != 0) ? (a / b + 1) : (a / b);
-}
-
// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
(DIR) diff --git a/src/utility.h b/src/utility.h
t@@ -5,17 +5,10 @@
//Round a / b to nearest higher integer value
-unsigned int iDivUp(unsigned int a, unsigned int b) {
- return (a % b != 0) ? (a / b + 1) : (a / b);
-}
+unsigned int iDivUp(unsigned int a, unsigned int b);
// Swap two arrays pointers
-void swapFloatArrays(Float* arr1, Float* arr2)
-{
- Float* tmp = arr1;
- arr1 = arr2;
- arr2 = tmp;
-}
-
+void swapFloatArrays(Float* arr1, Float* arr2);
#endif
+// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4