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

Merge bence virtonomy2 #61

Merged
merged 26 commits into from
Sep 19, 2021
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
044095c
Verification cases thesis (#15)
BenceVirtonomy Aug 9, 2021
4e07e8b
Pressure bc (#16)
BenceVirtonomy Aug 11, 2021
0fcb10d
Add test folder (#18)
BenceVirtonomy Aug 11, 2021
c7f31cb
Pressure bc (#20)
BenceVirtonomy Aug 12, 2021
8c40661
simulation class remvoed (#21)
BenceVirtonomy Aug 16, 2021
3f695ee
fix numerical damping (#23)
BenceVirtonomy Aug 17, 2021
7abc672
Simbody lib seperate (#26)
BenceVirtonomy Sep 1, 2021
e4865a8
update simbody
BenceVirtonomy Sep 2, 2021
25960d0
Replace clapack (#27)
BenceVirtonomy Sep 3, 2021
e087d28
first setup of spring on surface normal direction (#22)
JohnVirtonomy Sep 3, 2021
213f05e
change pressure BC to be define by body part
BenceVirtonomy Sep 6, 2021
5be8001
SpringNormalOnSurfaceParticles with body part
BenceVirtonomy Sep 6, 2021
6c08a81
option to use inner or outer surface for spring
BenceVirtonomy Sep 6, 2021
1de1388
zero position of particles fixed
BenceVirtonomy Sep 6, 2021
54a3034
emscripten option to disable gtest (#28)
BenceVirtonomy Sep 9, 2021
62accea
Merge branch 'master' of https://github.com/BenceVirtonomy/SPHinXsys
Sep 9, 2021
edef55e
Merge branch 'fix_zero_pos_particles' of https://github.com/BenceVirt…
Sep 9, 2021
8289d4b
find simbody
Sep 9, 2021
0e50926
remove BUILD_WITH_SIMBODY from findsimbody
Sep 9, 2021
a204d60
bernoulli beam added
Sep 9, 2021
6357d08
bernoulli test case, no displacement
Sep 9, 2021
b9a1a44
bernoulli beam works with gravity
Sep 9, 2021
010337b
fix comments
BenceVirtonomy Sep 12, 2021
77c21de
add comment
BenceVirtonomy Sep 12, 2021
694ede1
merge master
chuvirtonomy Sep 14, 2021
79220bc
remove folder
Sep 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -1037,4 +1037,8 @@ _deps
modules.order
Module.symvers
Mkfile.old
dkms.conf
dkms.conf

# wasm build
build_wasm_release
build_wasm_debug
18 changes: 9 additions & 9 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[submodule "oneTBB"]
chuvirtonomy marked this conversation as resolved.
Show resolved Hide resolved
path = oneTBB
url = https://github.com/BenceVirtonomy/oneTBB
[submodule "SPHINXsys/src/shared/clapack_for_SPHinXsys"]
path = SPHINXsys/src/shared/clapack_for_SPHinXsys
url = https://github.com/BenceVirtonomy/clapack_for_SPHinXsys
[submodule "SPHINXsys/src/shared/simbody"]
path = SPHINXsys/src/shared/simbody
url = https://github.com/BenceVirtonomy/simbody
[submodule "3rd_party/simbody"]
path = 3rd_party/simbody
url = https://github.com/BenceVirtonomy/simbody.git
[submodule "3rd_party/eigen"]
path = 3rd_party/eigen
url = https://gitlab.com/libeigen/eigen.git
[submodule "3rd_party/wasmtbb"]
path = 3rd_party/wasmtbb
url = https://github.com/hpcwasm/wasmtbb.git
1 change: 1 addition & 0 deletions 3rd_party/eigen
Submodule eigen added at 314739
1 change: 1 addition & 0 deletions 3rd_party/simbody
Submodule simbody added at 7ef1b3
1 change: 1 addition & 0 deletions 3rd_party/wasmtbb
Submodule wasmtbb added at 6e5db4
71 changes: 57 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,43 @@ set(SPHINXSYS_PROJECT_DIR ${PROJECT_SOURCE_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${SPHINXSYS_PROJECT_DIR}/cmake)

###### Change settings in this file if you want to build with Simbody and/or oneTBB source code ######
option(STATIC_BUILD "STATIC_BUILD" 0)
option(ONLY_3D "ONLY_3D" 0)
include(Dependency_free_settings)
option(BUILD_WITH_SIMBODY "BUILD_WITH_SIMBODY" 0)
option(EMSCRIPTEN "EMSCRIPTEN" 0)
option(BUILD_TESTS "BUILD_TESTS" 1)

if(EMSCRIPTEN)
set(STATIC_BUILD 1)
set(BUILD_WITH_SIMBODY 1)
set(ONLY_3D 1)
set(BUILD_TESTS 1)
add_definitions(-D__SIMBODY_WITHOUT_LAPACK__)
add_definitions(-D__EIGEN__)
add_definitions(-D__EMSCRIPTEN__)

remove_definitions(-DTBB_2021_2_0)
set(TBB_ROOT ${SPHINXSYS_PROJECT_DIR}/3rd_party/wasmtbb)
include_directories("${TBB_ROOT}/include")
set(OBJDIR "${TBB_ROOT}/build/linux_wasm32_emscripten_emscripten_wasm32_release")
file(GLOB TBB_OBJECTS ${OBJDIR}/*.o)
else()
set(BOOST_AVAILABLE 1)
add_definitions(-DBOOST_AVAILABLE)
endif()

if(BUILD_WITH_SIMBODY)
add_definitions(-D__SIMBODY_WITHOUT_LAPACK__)
add_definitions(-D__EIGEN__)
set(EIGEN_ROOT ${SPHINXSYS_PROJECT_DIR}/3rd_party/eigen)
message("${EIGEN_ROOT}")
include_directories("${EIGEN_ROOT}")
endif()

if(STATIC_BUILD)
set(BUILD_STATIC_LIBRARIES 1) # Simbody
set(BUILD_DYNAMIC_LIBRARIES 0) # Simbody
endif()

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
Expand Down Expand Up @@ -39,18 +74,29 @@ if(MSVC)
SET(CMAKE_CL_64 1)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" " /MP")
add_definitions(-D_USE_MATH_DEFINES)
else(MSVC)
elseif(EMSCRIPTEN)
# set(PRE_POST "")
# #set(EM_FLAGS "${PRE_POST} -fPIC -g -O0 --profiling -DUNIX -D__linux__=1 --bind -std=c++11 -s USE_PTHREADS=1 -s DISABLE_EXCEPTION_CATCHING=0")
# set(EM_FLAGS "${PRE_POST} -fPIC -g -O3 -DUNIX -D__linux__=1 --bind -std=c++11 -s USE_PTHREADS=1 -s DISABLE_EXCEPTION_CATCHING=0")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EM_FLAGS}")
# set(EM_FLAGS " -s INITIAL_MEMORY=536870912 -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=0 -s ERROR_ON_UNDEFINED_SYMBOLS=1")
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EM_FLAGS}")
else()
add_compile_definitions(__linux__=1)
set(CMAKE_CXX_FLAGS "-Wall -Werror -std=c++11 -DUNIX -pthread")
set(CMAKE_CXX_FLAGS "-w -std=c++11 -DUNIX -pthread")
BenceVirtonomy marked this conversation as resolved.
Show resolved Hide resolved
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -ggdb")
IF(${CMAKE_BUILD_TYPE} MATCHES "Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ELSE(${CMAKE_BUILD_TYPE} MATCHES "Debug")
set(CMAKE_CXX_FLAGS "-fPIC ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}")
ENDIF(${CMAKE_BUILD_TYPE} MATCHES "Debug")
endif()

if(NOT BUILD_WITH_SIMBODY)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
endif()

endif(MSVC)
add_compile_definitions(TBB_SUPPRESS_DEPRECATED_MESSAGES=1)

message("===========================================")
Expand All @@ -70,23 +116,20 @@ endif()

enable_testing()

if(NOT WASM_BUILD)
include(Common)
include(Import3rdpartylibs)
include(Common)
include(Import3rdpartylibs)

if(BUILD_WITH_SIMBODY)
set(simbody_root "${SPHINXSYS_PROJECT_DIR}/3rd_party/simbody")
add_subdirectory(${simbody_root})
endif()

option(BUILD_TESTS "BUILD_TESTS" 1)
add_subdirectory(SPHINXsys)
if(BUILD_WITH_ONETBB)
add_subdirectory(oneTBB)
endif()

if(BUILD_TESTS)
add_subdirectory(tests)
endif()

add_subdirectory(cases_user)

if(ACTIVATE_CUDA)
add_subdirectory(cases_test_gpu)
endif()
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ubuntu:20.04

ARG build_with_dependencies_source=0
ARG sph_only_static_build=0
ARG STATIC_BUILD=0

ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
Expand Down Expand Up @@ -31,4 +31,4 @@ RUN cd /usr/src/gtest
cd /home/SPHinXsys

RUN rm -rf build
RUN mkdir build && cd build && cmake .. -DBUILD_WITH_DEPENDENCIES_SOURCE=${build_with_dependencies_source} -DSPH_ONLY_STATIC_BUILD=${sph_only_static_build} && make -j$(nproc)
RUN mkdir build && cd build && cmake .. -DBUILD_WITH_DEPENDENCIES_SOURCE=${build_with_dependencies_source} -DSTATIC_BUILD=${STATIC_BUILD} && make -j$(nproc)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Here, we give the instructions for installing on Ubuntu Linux, Apple OS and Wind

2. Edit the CMake variables to define which dependency to use. Simbody and/or TBB can be built by the project. If one is not built by the project, install that dependency in the usual way as written before.

Go to SPHinXsys/cmake/Dependency_free_settings.cmake
Go to SPHinXsys/cmake/Dependency_settings.cmake
Set BUILD_WITH_DEPENDENCIES to 1
Set BUILD_WITH_SIMBODY to 1 if Simbody should be built by the project
Set BUILD_WITH_ONETBB to 1 if TBB should be built by the project
Expand Down
7 changes: 0 additions & 7 deletions SPHINXsys/cmake/Dirsearch_shared.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
if(BUILD_WITH_SIMBODY)
include(Simbody_header_directories)
endif()
if(BUILD_WITH_ONETBB)
include(oneTBB_header_directory)
endif()

MACRO(HEADER_DIRECTORIES_SHARED return_list)
FILE(GLOB_RECURSE new_list ${PROJECT_SOURCE_DIR}/src/shared/*.h)
Expand All @@ -20,10 +17,6 @@ MACRO(HEADER_DIRECTORIES_SHARED return_list)
SET(dir_list ${dir_list} ${simbody_header_path})
ENDFOREACH()
endif()

if(BUILD_WITH_ONETBB)
SET(dir_list ${dir_list} ${ONETBB_HEADER_DIRECTORY})
endif()

SET(${return_list} ${dir_list})
ENDMACRO()
Expand Down
30 changes: 18 additions & 12 deletions SPHINXsys/cmake/Simbody_header_directories.cmake
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
set(SHP_SOURCE_DIRECTORY_FOR_INCLUDE_PATHS "")
set(SHP_SOURCE_DIRECTORY_FOR_INCLUDE_PATHS "${SPHINXSYS_PROJECT_DIR}") #SPHinXsys
set(simbody_root "${SPHINXSYS_PROJECT_DIR}/3rd_party/simbody")

set(SIMBODY_HEADER_DIRECTORIES
"${SHP_SOURCE_DIRECTORY_FOR_INCLUDE_PATHS}/SPHINXsys/src/shared/simbody/SimTKcommon/BigMatrix/include"
"${SHP_SOURCE_DIRECTORY_FOR_INCLUDE_PATHS}/SPHINXsys/src/shared/simbody/SimTKcommon/Geometry/include"
"${SHP_SOURCE_DIRECTORY_FOR_INCLUDE_PATHS}/SPHINXsys/src/shared/simbody/SimTKcommon/Mechanics/include"
"${SHP_SOURCE_DIRECTORY_FOR_INCLUDE_PATHS}/SPHINXsys/src/shared/simbody/SimTKcommon/Polynomial/include"
"${SHP_SOURCE_DIRECTORY_FOR_INCLUDE_PATHS}/SPHINXsys/src/shared/simbody/SimTKcommon/Random/include"
"${SHP_SOURCE_DIRECTORY_FOR_INCLUDE_PATHS}/SPHINXsys/src/shared/simbody/SimTKcommon/Scalar/include"
"${SHP_SOURCE_DIRECTORY_FOR_INCLUDE_PATHS}/SPHINXsys/src/shared/simbody/SimTKcommon/Simulation/include"
"${SHP_SOURCE_DIRECTORY_FOR_INCLUDE_PATHS}/SPHINXsys/src/shared/simbody/SimTKcommon/SmallMatrix/include"
"${SHP_SOURCE_DIRECTORY_FOR_INCLUDE_PATHS}/SPHINXsys/src/shared/simbody/SimTKmath/Geometry/include"
"${SHP_SOURCE_DIRECTORY_FOR_INCLUDE_PATHS}/SPHINXsys/src/shared/simbody/SimTKmath/Integrators/include"
"${simbody_root}/SimTKcommon/BigMatrix/include"
"${simbody_root}/SimTKcommon/Geometry/include"
"${simbody_root}/SimTKcommon/Mechanics/include"
"${simbody_root}/SimTKcommon/Polynomial/include"
"${simbody_root}/SimTKcommon/Random/include"
"${simbody_root}/SimTKcommon/Scalar/include"
"${simbody_root}/SimTKcommon/Simulation/include"
"${simbody_root}/SimTKcommon/SmallMatrix/include"
"${simbody_root}/SimTKcommon/include"

"${simbody_root}/SimTKmath/Geometry/include"
"${simbody_root}/SimTKmath/Integrators/include"
"${simbody_root}/SimTKmath/include"

"${simbody_root}/Simbody/include"
"${simbody_root}/Simbody/include/simbody/internal"
"${simbody_root}/Simbody/Visualizer/include"
)
5 changes: 0 additions & 5 deletions SPHINXsys/cmake/oneTBB_header_directory.cmake

This file was deleted.

87 changes: 60 additions & 27 deletions SPHINXsys/src/for_2D_build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ LIST(REMOVE_ITEM usefulsubdirs ${CMAKE_CURRENT_SOURCE_DIR})

##Add all useful subdirectories
FOREACH(subdir_path ${usefulsubdirs})
#message(STATUS ${subdir_path})
ADD_SUBDIRECTORY(${subdir_path})
ENDFOREACH()

Expand Down Expand Up @@ -50,32 +49,66 @@ FOREACH(srcdir_path ${sourcedirs})
list(APPEND SCR_FILES ${DIR_scrs})
ENDFOREACH()

#FOREACH(file1 ${SCR_FILES})
#message(STATUS ${file1})
#ENDFOREACH()

ADD_LIBRARY(sphinxsys_2d SHARED ${SCR_FILES})
ADD_LIBRARY(sphinxsys_static_2d STATIC ${SCR_FILES})

SET_TARGET_PROPERTIES(sphinxsys_static_2d PROPERTIES OUTPUT_NAME "sphinxsys_2d")
#SET_TARGET_PROPERTIES(sphinxsys PROPERTIES VERSION 1.0 SOVERSION 0)

SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

if(MSVC)
target_link_libraries(sphinxsys_2d ${TBB_LIBRARYS} ${Simbody_LIBRARIES})
else(MSVC)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
target_link_libraries(sphinxsys_2d ${TBB_LIBRARYS} ${Simbody_LIBRARIES} ${Boost_LIBRARIES} stdc++)
else(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
target_link_libraries(sphinxsys_2d ${TBB_LIBRARYS} ${Simbody_LIBRARIES} stdc++ stdc++fs)
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
endif(MSVC)

INSTALL(TARGETS sphinxsys_2d sphinxsys_static_2d
RUNTIME DESTINATION 2d_code/bin
LIBRARY DESTINATION 2d_code/lib
ARCHIVE DESTINATION 2d_code/lib)
if(NOT STATIC_BUILD)
### SPHinXsys dynamic lib ###
ADD_LIBRARY(sphinxsys_2d SHARED ${SCR_FILES})

if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
#target_link_libraries(sphinxsys_3d)
else(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
target_link_libraries(sphinxsys_2d stdc++)
else(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
target_link_libraries(sphinxsys_2d stdc++ stdc++fs)
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

if(DEFINED BOOST_AVAILABLE) # link Boost if available (not for Windows)
target_link_libraries(sphinxsys_2d ${Boost_LIBRARIES})
endif()
endif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")

if(BUILD_WITH_SIMBODY)
target_link_libraries(sphinxsys_2d SimTKcommon SimTKmath SimTKsimbody ${TBB_LIBRARYS})
else()
target_link_libraries(sphinxsys_2d ${Simbody_LIBRARIES} ${TBB_LIBRARYS})
endif()
### SPHinXsys dynamic lib ###
else()
### SPHinXsys static lib ###
ADD_LIBRARY(sphinxsys_static_2d STATIC ${SCR_FILES})
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
#target_link_libraries(sphinxsys_3d)
else(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
target_link_libraries(sphinxsys_static_2d stdc++)
else(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
target_link_libraries(sphinxsys_static_2d stdc++ stdc++fs)
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

if(DEFINED BOOST_AVAILABLE) # link Boost if available (not for Windows)
target_link_libraries(sphinxsys_static_2d ${Boost_LIBRARIES})
endif()
endif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")

if(BUILD_WITH_SIMBODY)
target_link_libraries(sphinxsys_static_2d SimTKcommon_static SimTKmath_static SimTKsimbody_static ${TBB_LIBRARYS})
else()
target_link_libraries(sphinxsys_static_2d ${Simbody_LIBRARIES} ${TBB_LIBRARYS})
endif()
### SPHinXsys static lib ###
endif()

if(NOT STATIC_BUILD)
INSTALL(TARGETS sphinxsys_2d
RUNTIME DESTINATION 2d_code/bin
LIBRARY DESTINATION 2d_code/lib
ARCHIVE DESTINATION 2d_code/lib)
else()
INSTALL(TARGETS sphinxsys_static_2d
RUNTIME DESTINATION 2d_code/bin
LIBRARY DESTINATION 2d_code/lib
ARCHIVE DESTINATION 2d_code/lib)
endif()

FILE(GLOB_RECURSE hpp_headers ${PROJECT_SOURCE_DIR}/src/shared/*.hpp ${PROJECT_SOURCE_DIR}/src/for_2D_build/*.hpp)
INSTALL(FILES ${hpp_headers} DESTINATION 2d_code/include)
Loading