Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CUDA Implementation of WCSPH and DFSPH #53

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
6 changes: 3 additions & 3 deletions CMake/NeighborhoodSearch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ else(BUILD_SHARED_LIBS)
set(LIB_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
endif(BUILD_SHARED_LIBS)

option(USE_GPU_NEIGHBORHOOD_SEARCH "Use GPU neighborhood search" OFF)
option(USE_GPU_NEIGHBORHOOD_SEARCH "Use GPU neighborhood search" ON)

if(USE_GPU_NEIGHBORHOOD_SEARCH)

Expand All @@ -24,8 +24,8 @@ if(USE_GPU_NEIGHBORHOOD_SEARCH)
ExternalProject_Add(
Ext_NeighborhoodSearch
PREFIX "${CMAKE_SOURCE_DIR}/extern/cuNSearch"
GIT_REPOSITORY https://github.com/InteractiveComputerGraphics/cuNSearch.git
GIT_TAG "aba3da18cb4f45cd05d729465d1725891ffc33da"
GIT_REPOSITORY https://gitlab.com/R.Baumgartner/cunsearch_update.git
GIT_TAG "9cd6d64c03a1b60d6eb99dcaf4fe647f90fe7020"
INSTALL_DIR ${ExternalInstallDir}/NeighborhoodSearch
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${EXT_CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} -DCMAKE_INSTALL_PREFIX:PATH=${ExternalInstallDir}/NeighborhoodSearch -DCUNSEARCH_USE_DOUBLE_PRECISION:BOOL=${USE_DOUBLE_PRECISION} -DBUILD_DEMO:BOOL=OFF
)
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ ExternalProject_Add(
Ext_Discregrid
PREFIX "${CMAKE_SOURCE_DIR}/extern/Discregrid"
GIT_REPOSITORY https://github.com/InteractiveComputerGraphics/Discregrid.git
GIT_TAG "c0fb5aeac4c8a83e9f37c720315f13a834409b81"
#GIT_TAG "c0fb5aeac4c8a83e9f37c720315f13a834409b81"
GIT_TAG "c992835894e32427f9d4d7262f301df7454150c9"
INSTALL_DIR ${ExternalInstallDir}/Discregrid
CMAKE_ARGS -DCMAKE_BUILD_TYPE:STRING=${EXT_CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${ExternalInstallDir}/Discregrid -DBUILD_CMD_EXECUTABLE:BOOL=0 -DEIGEN3_INCLUDE_DIR:PATH=${EIGEN3_INCLUDE_DIR}
)
30 changes: 30 additions & 0 deletions SPlisHSPlasH/BoundaryModel_Akinci2012.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,26 @@ namespace SPH
virtual void loadState(BinaryFileReader &binReader);

void initModel(RigidBodyObject *rbo, const unsigned int numBoundaryParticles, Vector3r *boundaryParticles);

FORCE_INLINE const Vector3r &getRigidBodyPosition()
{
return m_rigidBody->getPosition();
}

FORCE_INLINE const bool isDynamic()
{
return m_rigidBody->isDynamic();
}

FORCE_INLINE std::vector<Vector3r> &getForcesPerThread()
{
return m_forcePerThread;
}

FORCE_INLINE std::vector<Vector3r> &getTorquesPerThread()
{
return m_torquePerThread;
}

FORCE_INLINE Vector3r &getPosition0(const unsigned int i)
{
Expand Down Expand Up @@ -77,6 +97,11 @@ namespace SPH
m_x[i] = pos;
}

FORCE_INLINE std::vector<Vector3r> &getVelocities()
{
return m_v;
}

FORCE_INLINE Vector3r &getVelocity(const unsigned int i)
{
return m_v[i];
Expand All @@ -92,6 +117,11 @@ namespace SPH
m_v[i] = vel;
}

FORCE_INLINE std::vector<Real>& getVolumes()
{
return m_V;
}

FORCE_INLINE const Real& getVolume(const unsigned int i) const
{
return m_V[i];
Expand Down
17 changes: 16 additions & 1 deletion SPlisHSPlasH/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
set(WCSPH_HEADER_FILES
WCSPH/SimulationDataWCSPH.h
WCSPH/TimeStepWCSPH.h

WCSPH/TimeStepWCSPHGPU.h
)

set(WCSPH_SOURCE_FILES
WCSPH/SimulationDataWCSPH.cpp
WCSPH/TimeStepWCSPH.cpp

WCSPH/TimeStepWCSPHGPU.cu
)

set(PCISPH_HEADER_FILES
Expand Down Expand Up @@ -43,11 +47,15 @@ set(IISPH_SOURCE_FILES
set(DFSPH_HEADER_FILES
DFSPH/SimulationDataDFSPH.h
DFSPH/TimeStepDFSPH.h

DFSPH/TimeStepDFSPHGPU.h
)

set(DFSPH_SOURCE_FILES
DFSPH/SimulationDataDFSPH.cpp
DFSPH/TimeStepDFSPH.cpp

DFSPH/TimeStepDFSPHGPU.cu
)

set(PF_HEADER_FILES
Expand All @@ -59,6 +67,11 @@ set(PF_SOURCE_FILES
PF/SimulationDataPF.cpp
PF/TimeStepPF.cpp
)

set(GPU_UTILS
UtilitiesGPU/Kernels.cuh
UtilitiesGPU/Kernels.cu
)

set(SURFACETENSION_HEADER_FILES
SurfaceTension/SurfaceTensionBase.h
Expand Down Expand Up @@ -178,7 +191,7 @@ include_directories(${PROJECT_PATH}/extern/install/Discregrid/include)
############################################################
include_directories(${PROJECT_PATH}/extern/install/GenericParameters/include)

add_library(SPlisHSPlasH
cuda_add_library(SPlisHSPlasH
Common.h

NeighborhoodSearch.h
Expand Down Expand Up @@ -251,6 +264,8 @@ add_library(SPlisHSPlasH

${UTILS_HEADER_FILES}
${UTILS_SOURCE_FILES}

${GPU_UTILS}
)

add_dependencies(SPlisHSPlasH Ext_NeighborhoodSearch)
Expand Down
Loading