diff --git a/.gitignore b/.gitignore index 51b3c53b6..3aeffab4c 100644 --- a/.gitignore +++ b/.gitignore @@ -26,8 +26,13 @@ err.job runit dumps* src/BUILD +src/build src/BUILD/** +src/build/** dumps-* +tpl +tpl/** +python # These are files automatically generated in our configure process. src/aclocal.m4 diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..779a39c3c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ + +[submodule "blt"] + path = cmake/blt + url = https://github.com/llnl/blt diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 238afc579..000000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -# CMakeLists to build the Spheral library. -cmake_minimum_required(VERSION 3.4) -project(spheral LANGUAGES CXX) - -################################ -# Include blt -################################ -set (SPHERAL_BLT_REL_DIR "${PROJECT_SOURCE_DIR}/../../cmake/blt" CACHE PATH "") -get_filename_component(SPHERAL_BLT_DIR "${SPHERAL_BLT_REL_DIR}" ABSOLUTE) - -if (NOT EXISTS "${SPHERAL_BLT_DIR}/SetupBLT.cmake") - message(FATAL_ERROR - "${SPHERAL_BLT_DIR} is not present.\n" - "call cmake with -DSPHERAL_BLT_DIR=/your/installation/of/blt\n") -endif() - -include(${SPHERAL_BLT_DIR}/SetupBLT.cmake) - -option(ENABLE_2D "enable 2d" ON) -option(ENABLE_3D "enable 3d" ON) -option(ENABLE_INSTANTIATIONS "enable instantiations" ON) - -################################ -# Include standard build system logic and options -################################ -include(cmake/CMakeBasics.cmake) - -add_subdirectory(src) - -install(EXPORT ${PROJECT_NAME}-targets DESTINATION lib/cmake) diff --git a/cmake/CMakeBasics.cmake b/cmake/CMakeBasics.cmake index 612bea963..20edec234 100644 --- a/cmake/CMakeBasics.cmake +++ b/cmake/CMakeBasics.cmake @@ -3,11 +3,6 @@ ############################################################################### # Basic -# Libraries -include(cmake/SetupLibraries.cmake) - -find_package(PythonInterp) - # Instantiate and add source files to the project # _inst_var : *name* of list variable containing base names to instantiate # The file ${_inst_var}Inst.cc.py must exist. @@ -15,7 +10,7 @@ find_package(PythonInterp) # to the source files, if it exists. # _source_var : *name* of list variable to append source files to. function(instantiate _inst_var _source_var) - set(_dims) + set(_dims 1) if(ENABLE_2D) list(APPEND _dims 2) endif() @@ -28,9 +23,9 @@ function(instantiate _inst_var _source_var) if(ENABLE_INSTANTIATIONS) foreach(_dim ${_dims}) set(_inst_py ${CMAKE_CURRENT_SOURCE_DIR}/${_inst}Inst.cc.py) - set(_inst_file ${_inst}Inst.cc.${_dim}.cc) + set(_inst_file ${_inst}Inst${_dim}d.cc) # Run the python script to generate the instantiation files - execute_process(COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/helpers/InstantiationGenerator.py + execute_process(COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/helpers/InstantiationGenerator.py ${_inst_py} ${_inst_file} ${_dim} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) @@ -58,10 +53,13 @@ else() add_definitions("-DDEBUG=0") endif() -add_definitions(-DCXXONLY=1) +if(ENABLE_CXXONLY) + add_definitions(-DCXXONLY=1) +endif() add_definitions(-DUSE_TETGEN=0) add_definitions(-DUSE_TRIANGLE=0) add_definitions(-DNOPOLYTOPE=1) +add_definitions(-DSPHERAL1D=1) if(ENABLE_2D) add_definitions(-DSPHERAL2D=1) endif() @@ -69,7 +67,9 @@ if(ENABLE_3D) add_definitions(-DNOR3D=1) add_definitions(-DSPHERAL3D=1) endif() -add_definitions(-DTIMER=1) +if(ENABLE_TIMER) + add_definitions(-DTIMER=1) +endif() if (ENABLE_MPI) add_definitions(-DUSE_MPI=1) diff --git a/cmake/InstallLibraries.cmake b/cmake/InstallLibraries.cmake new file mode 100644 index 000000000..a3201557c --- /dev/null +++ b/cmake/InstallLibraries.cmake @@ -0,0 +1,532 @@ +set(PATCH_DIR ${PROJECT_SOURCE_DIR}/thirdPartyLibs) +set(CACHE_DIR ${PROJECT_SOURCE_DIR}/thirdPartyLibs/cache) + +set(SPHERAL_TPL_DIR ${SPHERAL_INSTALL_DIR}) +if(SPHERAL_TPL_DIR) + if(NOT EXISTS SPHERAL_TPL_DIR) + get_filename_component(SPHERAL_TPL_DIR_PARENT ${SPHERAL_TPL_DIR} DIRECTORY) + if(NOT EXISTS "${SPHERAL_TPL_DIR_PARENT}/") + set(SPHERAL_TPL_DIR ${PROJECT_SOURCE_DIR}/..) + message(FATAL_ERROR "No Directory ${SPHERAL_TPL_DIR_PARENT}/") + endif() + endif() +else() + set(SPHERAL_TPL_DIR ${PROJECT_SOURCE_DIR}/..) +endif() +set(SPHERAL_TPL_DIR ${SPHERAL_TPL_DIR}/tpl) +message(STATUS "TPL Install Dir at: ${SPHERAL_TPL_DIR}") + + + +function(DownloadAndBuildLib TARGET_NAME) + if(NOT EXISTS ${${TARGET_NAME}_EXISTS_FILE}) + set(${TARGET_NAME}_CMAKE_LIST_CONTENT " + cmake_minimum_required(VERSION 3.10) + include(ExternalProject) + + ${${TARGET_NAME}_EXTERNAL_PROJECT_FUNCTION} + + add_custom_target(trigger_${${TARGET_NAME}_TARGET}) + add_dependencies(trigger_${${TARGET_NAME}_TARGET} ${${TARGET_NAME}_TARGET}) + ") + + set(trigger_build_dir ${CMAKE_BINARY_DIR}/force_${TARGE_NAME}) + #mktemp dir in build tree + file(MAKE_DIRECTORY ${trigger_build_dir} ${trigger_build_dir}/build) + #generate false dependency project + file(WRITE ${trigger_build_dir}/CMakeLists.txt ${${TARGET_NAME}_CMAKE_LIST_CONTENT}) + execute_process(COMMAND ${CMAKE_COMMAND} .. + WORKING_DIRECTORY ${trigger_build_dir}/build + ) + execute_process(COMMAND ${CMAKE_COMMAND} --build . -j32 + WORKING_DIRECTORY ${trigger_build_dir}/build + ) + + if(NOT EXISTS ${${TARGET_NAME}_EXISTS_FILE}) + message(FATAL_ERROR "Failed to build ${TARGET_NAME}") + endif() + + else() + message(STATUS "${TARGET_NAME} Built") + endif() +endfunction() + + + +################################ +# BOOST +################################ +if(INSTALL_TPLS AND NOT BOOST_DIR) + message("\n---------- BUILDING BOOST ----------") + set(BOOST_PREFIX ${SPHERAL_TPL_DIR}) + set(BOOST_TARGET boost) + set(BOOST_DIR "${BOOST_PREFIX}/boost") + set(BOOST_EXISTS_FILE "${BOOST_PREFIX}/boost/lib/libboost_system.a") + set(BOOST_CACHE "${CACHE_DIR}/boost_1_69_0.tar.bz2") + + if (NOT BOOST_URL) + if (EXISTS ${BOOST_CACHE}) + set(BOOST_URL ${BOOST_CACHE}) + else() + set(BOOST_URL "https://sourceforge.net/projects/boost/files/boost/1.69.0/boost_1_69_0.tar.bz2") + endif() + + endif() + + set(BOOST_SRC_DIR "${BOOST_PREFIX}/boost/src/boost") + set(BOOST_EXTERNAL_PROJECT_FUNCTION " + ExternalProject_add(${BOOST_TARGET} + PREFIX ${BOOST_PREFIX}/${BOOST_TARGET} + URL ${BOOST_URL} + DOWNLOAD_DIR ${CACHE_DIR} + #PATCH_COMMAND patch -t ${BOOST_SRC_DIR}/config/config.guess ${PATCH_DIR}/config.guess-boost-4.10.2-bsd.patch && + # patch -t ${BOOST_SRC_DIR}/config/config.sub ${PATCH_DIR}/config.sub-boost-4.10.2-bsd.patch + CONFIGURE_COMMAND env CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} ${BOOST_SRC_DIR}/bootstrap.sh + --with-toolset=${CMAKE_C_COMPILER_ID} + --without-libraries=atomic,container,coroutine,log,chrono,context,date_time,exception,fiber,filesystem,graph,graph_parallel,iostreams,locale,math,mpi,program_options,python,random,regex,serialization,system,test,thread,timer,type_erasure,wave + --prefix=${BOOST_DIR} + BUILD_IN_SOURCE 1 + BUILD_COMMAND ${BOOST_SRC_DIR}/b2 install + INSTALL_COMMAND echo \"Skipping Install Step\" + ) + ") + DownloadAndBuildLib(BOOST) + message("--------------------------------------\n") +endif() + +if (BOOST_DIR) + include(../cmake/libraries/FindBOOST.cmake) + if (BOOST_FOUND) + blt_register_library( NAME BOOST + INCLUDES ${BOOST_INCLUDE_DIRS} + DEFINES HAVE_BOOST=1 ) + else() + message(FATAL_ERROR "Unable to find BOOST with given path.") + endif() +else() + message(STATUS "Library Disabled: BOOST") + set(BLT_BOOST_DEFINES "HAVE_BOOST=0" CACHE PATH "") +endif() + + + +################################ +# PYTHON +################################ +if(INSTALL_TPLS AND NOT PYTHON_DIR) + message("\n---------- BUILDING PYTHON ----------") + get_filename_component(PYTHON_PREFIX ${SPHERAL_TPL_DIR} DIRECTORY) + set(PYTHON_PREFIX "${PYTHON_PREFIX}") + set(PYTHON_TARGET python) + set(PYTHON_DIR ${PYTHON_PREFIX}/python) + set(PYTHON_EXISTS_FILE "${PYTHON_DIR}/include/python2.7/Python.h") + set(PYTHON_CACHE "${CACHE_DIR}/Python-2.7.15.tgz") + + if(NOT PYTHON_URL) + if (EXISTS ${PYTHON_CACHE}) + set(PYTHON_URL ${PYTHON_CACHE}) + else() + set(PYTHON_URL "http://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz") + endif() + endif() + + set(_PYTHON_SRC_DIR "${PYTHON_PREFIX}/python/src/python") + set(PYTHON_EXTERNAL_PROJECT_FUNCTION " + ExternalProject_add(${PYTHON_TARGET} + PREFIX ${PYTHON_PREFIX}/${PYTHON_TARGET} + URL ${PYTHON_URL} + DOWNLOAD_DIR ${CACHE_DIR} + CONFIGURE_COMMAND env CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} ${_PYTHON_SRC_DIR}/configure + --with-cxx-main='${CMAKE_CXX_COMPILER}' + --disable-ipv6 + --prefix=${PYTHON_PREFIX}/${PYTHON_TARGET} + BUILD_COMMAND make -j32 + INSTALL_COMMAND make install + ) + ") + + DownloadAndBuildLib(PYTHON) + message("--------------------------------------\n") +endif() + +set(PIPTARGETS + setuptools + PYB11Generator + mpi4py + numpy-stl + matplotlib + ) + +if(PYTHON_DIR) + ################################ + # CONFUGURING PIP/PYTHON LIBS + ################################ + set(PYTHON_EXE ${PYTHON_DIR}/bin/python2.7) + set(PYTHON_SITE_PACKAGE_DIR ${PYTHON_DIR}/lib/python2.7/site-packages) + set(PYTHON_EXECUTABLE ${PYTHON_EXE}) + set(PIP_EXE ${PYTHON_DIR}/bin/pip2.7) + set(PYTHON_VERSION "2.7") + + include(FindPythonModule) + + find_python_module(pip QUIET) + if(NOT PY_PIP) + set(PIP_DIST pip-9.0.1-py2.py3-none-any.whl) + if (NOT EXISTS ${CACHE_DIR}/${PIP_DIST}) + execute_process(COMMAND wget https://pypi.python.org/packages/b6/ac/7015eb97dc749283ffdec1c3a88ddb8ae03b8fad0f0e611408f196358da3/pip-9.0.1-py2.py3-none-any.whl#md5=297dbd16ef53bcef0447d245815f5144 +-O ${CACHE_DIR}/${PIP_DIST}) + endif() + execute_process(COMMAND ${PYTHON_EXE} ${CACHE_DIR}/${PIP_DIST}/pip install --no-index ${CACHE_DIR}/${PIP_DIST}) + endif() + + # Download and install PIP modules + foreach(_target ${PIPTARGETS}) + # Case for numpy-stl + set(_tmp_target ${_target}) + if(${_target} STREQUAL "numpy-stl") + set(_tmp_target stl) + endif() + + string(TOUPPER ${_tmp_target} _target_upper) + find_python_module(${_tmp_target} QUIET) + + if (NOT PY_${_target_upper}) + execute_process(COMMAND ${PIP_EXE} download --no-binary :all -d ${CACHE_DIR} ${_target}) + endif() + + if (NOT PY_${_target_upper}) + execute_process(COMMAND ${PIP_EXE} install --upgrade ${_target} --no-index --find-links ${CACHE_DIR}) + endif() + endforeach() + + find_python_module(Gnuplot QUIET) + if(NOT PY_GNUPLOT) + execute_process(COMMAND wget http://downloads.sourceforge.net/gnuplot-py/gnuplot-py-1.8.tar.gz -O ${CACHE_DIR}/gnuplot-py-1.8.tar.gz) + execute_process(COMMAND tar -xvf ${CACHE_DIR}/gnuplot-py-1.8.tar.gz) + execute_process(COMMAND ${PYTHON_EXE} setup.py install + WORKING_DIRECTORY gnuplot-py-1.8) + endif() +endif() + +# Find python +include(../cmake/libraries/FindPython.cmake) + + + +################################ +# PYBIND11 +################################ +if(INSTALL_TPLS AND NOT PYBIND11_DIR) + message("\n---------- BUILDING PYBIND11 ----------") + set(PYBIND11_PREFIX ${SPHERAL_TPL_DIR}/pybind11/) + set(PYBIND11_TARGET pybind11) + set(PYBIND11_DIR ${PYBIND11_PREFIX}) + set(PYBIND11_EXISTS_FILE "${PYBIND11_PREFIX}/include/pybind11/pybind11.h") + set(PYBIND11_CACHE "${CACHE_DIR}/v2.4.3.tar.gz") + + if (NOT PYBIND11_URL) + if (EXISTS ${PYBIND11_CACHE}) + set(PYBIND11_URL ${PYBIND11_CACHE}) + else() + set(PYBIND11_URL "https://github.com/pybind/pybind11/archive/v2.4.3.tar.gz") + endif() + endif() + + set(PYBIND11_CMAKE_ARGS "-DPYBIND11_TEST=Off -DCMAKE_INSTALL_PREFIX=${PYBIND11_PREFIX} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} ") + set(PYBIND11_EXTERNAL_PROJECT_FUNCTION " + ExternalProject_add(${PYBIND11_TARGET} + PREFIX ${PYBIND11_PREFIX}/${PYBIND11_TARGET} + URL ${PYBIND11_URL} + DOWNLOAD_DIR ${CACHE_DIR} + CMAKE_ARGS ${PYBIND11_CMAKE_ARGS} + ) + ") + DownloadAndBuildLib(PYBIND11) + message("--------------------------------------\n") +endif() + +if (PYBIND11_DIR) + include(../cmake/libraries/FindPybind11.cmake) + if (PYBIND11_FOUND) + blt_register_library( NAME pybind11 + INCLUDES ${PYBIND11_INCLUDE_DIRS} + #LIBRARIES ${PYBIND11_LIBRARY} + DEFINES HAVE_PYBIND11=1 ) + else() + message(FATAL_ERROR "Unable to find PYBIND11 with given path. ${PYBIND11_DIR}") + endif() +else() + message(STATUS "Library Disabled: PYBIND11") + set(BLT_PYBIND11_DEFINES "HAVE_PYBIND11=0" CACHE PATH "") +endif() + + + +################################ +# POLYTOPE +################################ +if(INSTALL_TPLS AND NOT POLYTOPE_DIR) + message("\n---------- BUILDING POLYTOPE ----------") + set(POLYTOPE_PREFIX ${SPHERAL_TPL_DIR}/polytope/) + set(POLYTOPE_TARGET polytope) + set(POLYTOPE_DIR ${POLYTOPE_PREFIX}) + set(POLYTOPE_EXISTS_FILE "${POLYTOPE_PREFIX}/include/polytope/polytope.hh") + set(POLYTOPE_CACHE "${CACHE_DIR}/0.6.2.tar.gz") + + if (NOT POLYTOPE_URL) + if (EXISTS ${POLYTOPE_CACHE}) + set(POLYTOPE_URL ${POLYTOPE_CACHE}) + else() + set(POLYTOPE_URL "https://github.com/pbtoast/polytope/archive/0.6.2.tar.gz") + endif() + endif() + + set(POLYTOPE_CMAKE_ARGS "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_INSTALL_PREFIX=${POLYTOPE_PREFIX} + -DPYBIND11_INCLUDE_DIRS=${PYBIND11_INCLUDE_DIRS} + -DUSE_PYTHON=On + -DPYTHON_EXE=${PYTHON_EXE} + -DBoost_INCLUDE_DIR=${BOOST_INCLUDE_DIRS} + -DTESTING=Off") + set(POLYTOPE_EXTERNAL_PROJECT_FUNCTION " + ExternalProject_add(${POLYTOPE_TARGET} + PREFIX ${POLYTOPE_PREFIX}/${POLYTOPE_TARGET} + PATCH_COMMAND patch -t ${POLYTOPE_PREFIX}/polytope/src/polytope/CMakeLists.txt ${PATCH_DIR}/polytope-CMakeLists.patch && + patch -t ${POLYTOPE_PREFIX}/polytope/src/polytope/src/PYB11/CMakeLists.txt ${PATCH_DIR}/polytope-PYB11-CMakeLists.patch + + URL ${POLYTOPE_URL} + DOWNLOAD_DIR ${CACHE_DIR} + CMAKE_ARGS ${POLYTOPE_CMAKE_ARGS} + ) + ") + DownloadAndBuildLib(POLYTOPE) + message("---------------------------------------\n") +endif() + +if (POLYTOPE_DIR) + include(../cmake/libraries/FindPolytope.cmake) + if (POLYTOPE_FOUND) + blt_register_library( NAME polytope + INCLUDES ${POLYTOPE_INCLUDE_DIRS} + LIBRARIES ${POLYTOPE_LIBRARY} + DEFINES HAVE_POLYTOPE=1 ) + else() + message(FATAL_ERROR "Unable to find POLYTOPE with given path.") + endif() +else() + message(STATUS "Library Disabled: POLYTOPE") + set(BLT_POLYTOPE_DEFINES "HAVE_POLYTOPE=0" CACHE PATH "") +endif() + + + +################################ +# EIGEN +################################ +if(INSTALL_TPLS AND NOT EIGEN_DIR) + message("\n---------- BUILDING EIGEN ----------") + set(EIGEN_PREFIX ${SPHERAL_TPL_DIR}/eigen/) + set(EIGEN_TARGET eigen) + set(EIGEN_DIR ${EIGEN_PREFIX}) + set(EIGEN_EXISTS_FILE "${EIGEN_PREFIX}/include/eigen3/Eigen/Eigen") + set(EIGEN_CACHE "${CACHE_DIR}/3.3.7.tar.gz") + + if (NOT EIGEN_URL) + if (EXISTS ${EIGEN_CACHE}) + set(EIGEN_URL ${EIGEN_CACHE}) + else() + set(EIGEN_URL "https://github.com/eigenteam/eigen-git-mirror/archive/3.3.7.tar.gz") + endif() + endif() + + set(EIGEN_CMAKE_ARGS "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_INSTALL_PREFIX=${EIGEN_PREFIX}") + set(EIGEN_EXTERNAL_PROJECT_FUNCTION " + ExternalProject_add(${EIGEN_TARGET} + PREFIX ${EIGEN_PREFIX}/${EIGEN_TARGET} + URL ${EIGEN_URL} + DOWNLOAD_DIR ${CACHE_DIR} + CMAKE_ARGS ${EIGEN_CMAKE_ARGS} + ) + ") + DownloadAndBuildLib(EIGEN) + message("---------------------------------------\n") +endif() + +if (EIGEN_DIR) + include(../cmake/libraries/FindEigen.cmake) + if (EIGEN_FOUND) + blt_register_library( NAME eigen + INCLUDES ${EIGEN_INCLUDE_DIRS} + DEFINES HAVE_EIGEN=1 ) + else() + message(FATAL_ERROR "Unable to find EIGEN with given path.") + endif() +else() + message(STATUS "Library Disabled: EIGEN") + set(BLT_EIGEN_DEFINES "HAVE_EIGEN=0" CACHE PATH "") +endif() + + + +################################ +# QHULL +################################ +if(INSTALL_TPLS AND NOT QHULL_DIR) + message("\n---------- BUILDING QHULL ----------") + set(QHULL_PREFIX ${SPHERAL_TPL_DIR}) + set(QHULL_TARGET qhull) + set(QHULL_DIR ${QHULL_PREFIX}/qhull) + set(QHULL_EXISTS_FILE "${QHULL_DIR}/lib/libqhullstatic.a") + set(QHULL_CACHE "${CACHE_DIR}/2019.1.tar.gz") + + if (NOT QHULL_URL) + if (EXISTS ${QHULL_CACHE}) + set(QHULL_URL ${QHULL_CACHE}) + else() + set(QHULL_URL "https://github.com/qhull/qhull/archive/2019.1.tar.gz") + endif() + endif() + + set(QHULL_CMAKE_ARGS "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_FLAGS=-fPIC -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=${QHULL_DIR}") + set(QHULL_SRC_DIR ${QHULL_DIR}/src/qhull/src) + set(QHULL_EXTERNAL_PROJECT_FUNCTION " + ExternalProject_add(${QHULL_TARGET} + PREFIX ${QHULL_PREFIX}/${QHULL_TARGET} + PATCH_COMMAND patch -t ${QHULL_SRC_DIR}/libqhull/qhull_a.h ${PATCH_DIR}/qhull-2015.2-qhull_a.h-patch && + patch -t ${QHULL_SRC_DIR}/libqhull_r/qhull_ra.h ${PATCH_DIR}/qhull-2015.2-qhull_ra.h-patch + URL ${QHULL_URL} + DOWNLOAD_DIR ${CACHE_DIR} + CMAKE_ARGS ${QHULL_CMAKE_ARGS} + ) +") + DownloadAndBuildLib(QHULL) + message("--------------------------------------\n") +endif() + +if (QHULL_DIR) + include(../cmake/libraries/FindQhull.cmake) + if (QHULL_FOUND) + blt_register_library( NAME qhull + INCLUDES ${QHULL_INCLUDE_DIRS} + LIBRARIES ${QHULL_LIBRARY} + DEFINES HAVE_QHULL=1 ) + else() + message(FATAL_ERROR "Unable to find QHULL with given path.") + endif() +else() + message(STATUS "Library Disabled: QHULL") + set(BLT_QHULL_DEFINES "HAVE_QHULL=0" CACHE PATH "") +endif() + + + +################################ +# HDF5 +################################ +if(INSTALL_TPLS AND NOT HDF5_DIR) + message("\n---------- BUILDING HDF5 ----------") + set(HDF5_PREFIX ${SPHERAL_TPL_DIR}) + set(HDF5_TARGET hdf5) + set(HDF5_DIR "${HDF5_PREFIX}/hdf5") + set(HDF5_EXISTS_FILE "${HDF5_PREFIX}/hdf5/lib/libhdf5.a") + set(HDF5_CACHE "${CACHE_DIR}/hdf5-1.10.4.tar.bz2") + + if (NOT HDF5_URL) + if (EXISTS ${HDF5_CACHE}) + set(HDF5_URL ${HDF5_CACHE}) + else() + set(HDF5_URL "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.4/src/hdf5-1.10.4.tar.bz2") + endif() + endif() + + set(HDF5_SRC_DIR "${HDF5_PREFIX}/hdf5/src/hdf5") + set(HDF5_EXTERNAL_PROJECT_FUNCTION " + ExternalProject_add(${HDF5_TARGET} + PREFIX ${HDF5_PREFIX}/${HDF5_TARGET} + URL ${HDF5_URL} + DOWNLOAD_DIR ${CACHE_DIR} + CONFIGURE_COMMAND env CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} ${HDF5_SRC_DIR}/configure + --prefix=${HDF5_PREFIX}/${HDF5_TARGET} + BUILD_COMMAND make -j32 + INSTALL_COMMAND make install + ) + ") + DownloadAndBuildLib(HDF5) + message("--------------------------------------\n") +endif() + +if (HDF5_DIR) + include(../cmake/libraries/FindHDF5.cmake) + if (HDF5_FOUND) + blt_register_library( NAME hdf5 + INCLUDES ${HDF5_INCLUDE_DIRS} + LIBRARIES ${HDF5_LIBRARIES} + DEFINES HAVE_HDF5=1 ) + else() + message(FATAL_ERROR "Unable to find HDF5 with given path.") + endif() +else() + message(STATUS "Library Disabled: HDF5") + set(BLT_HDF5_DEFINES "HAVE_HDF5=0" CACHE PATH "") +endif() + + + +################################ +# SILO +################################ +if(INSTALL_TPLS AND NOT SILO_DIR) + message("\n---------- BUILDING SILO ----------") + set(SILO_PREFIX ${SPHERAL_TPL_DIR}) + set(SILO_TARGET silo) + set(SILO_DIR "${SILO_PREFIX}/silo") + set(SILO_EXISTS_FILE "${SILO_PREFIX}/silo/lib/libsiloh5.a") + set(SILO_CACHE "${CACHE_DIR}/silo-4.10.2-bsd.tar.gz") + + if(NOT SILO_URL) + if (EXISTS ${SILO_CACHE}) + set(SILO_URL ${SILO_CACHE}) + else() + set(SILO_URL "https://wci.llnl.gov/content/assets/docs/simulation/computer-codes/silo/silo-4.10.2/silo-4.10.2-bsd.tar.gz") + endif() + endif() + + set(SILO_SRC_DIR "${SILO_PREFIX}/silo/src/silo") + set(SILO_EXTERNAL_PROJECT_FUNCTION " + ExternalProject_add(${SILO_TARGET} + PREFIX ${SILO_PREFIX}/${SILO_TARGET} + URL ${SILO_URL} + DOWNLOAD_DIR ${CACHE_DIR} + PATCH_COMMAND patch -t ${SILO_SRC_DIR}/config/config.guess ${PATCH_DIR}/config.guess-silo-4.10.2-bsd.patch && + patch -t ${SILO_SRC_DIR}/config/config.sub ${PATCH_DIR}/config.sub-silo-4.10.2-bsd.patch + CONFIGURE_COMMAND env CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} ${SILO_SRC_DIR}/configure + --enable-shared=no + --enable-fortran=no + --with-hdf5=${HDF5_DIR}/include,${HDF5_DIR}/lib + --prefix=${SILO_PREFIX}/${SILO_TARGET} + --enable-silex=no + --enable-browser=yes + BUILD_COMMAND make -j32 + INSTALL_COMMAND make install + ) + ") + DownloadAndBuildLib(SILO) + message("--------------------------------------\n") +endif() + +if (SILO_DIR) + include(../cmake/libraries/FindSILO.cmake) + if (SILO_FOUND) + blt_register_library( NAME silo + INCLUDES ${SILO_INCLUDE_DIRS} + LIBRARIES ${SILO_LIBRARY} + DEPENDS_ON hdf5 + DEFINES HAVE_SILO=1 ) + else() + message(FATAL_ERROR "Unable to find SILO with given path.") + endif() +else() + message(STATUS "Library Disabled: SILO") + set(BLT_SILO_DEFINES "HAVE_SILO=0" CACHE PATH "") +endif() diff --git a/cmake/Modules/FindPackageHandleStandardArgs.cmake b/cmake/Modules/FindPackageHandleStandardArgs.cmake new file mode 100644 index 000000000..151d81250 --- /dev/null +++ b/cmake/Modules/FindPackageHandleStandardArgs.cmake @@ -0,0 +1,58 @@ +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME (DEFAULT_MSG|"Custom failure message") VAR1 ... ) +# This macro is intended to be used in FindXXX.cmake modules files. +# It handles the REQUIRED and QUIET argument to FIND_PACKAGE() and +# it also sets the _FOUND variable. +# The package is found if all variables listed are TRUE. +# Example: +# +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR) +# +# LibXml2 is considered to be found, if both LIBXML2_LIBRARIES and +# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE. +# If it is not found and REQUIRED was used, it fails with FATAL_ERROR, +# independent whether QUIET was used or not. +# If it is found, the location is reported using the VAR1 argument, so +# here a message "Found LibXml2: /usr/lib/libxml2.so" will be printed out. +# If the second argument is DEFAULT_MSG, the message in the failure case will +# be "Could NOT find LibXml2", if you don't like this message you can specify +# your own custom failure message there. + +MACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 ) + + IF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") + IF (${_NAME}_FIND_REQUIRED) + SET(_FAIL_MESSAGE "Could not find REQUIRED package ${_NAME}") + ELSE (${_NAME}_FIND_REQUIRED) + SET(_FAIL_MESSAGE "Could not find OPTIONAL package ${_NAME}") + ENDIF (${_NAME}_FIND_REQUIRED) + ELSE("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") + SET(_FAIL_MESSAGE "${_FAIL_MSG}") + ENDIF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") + + STRING(TOUPPER ${_NAME} _NAME_UPPER) + + SET(${_NAME_UPPER}_FOUND TRUE) + IF(NOT ${_VAR1}) + SET(${_NAME_UPPER}_FOUND FALSE) + ENDIF(NOT ${_VAR1}) + + FOREACH(_CURRENT_VAR ${ARGN}) + IF(NOT ${_CURRENT_VAR}) + SET(${_NAME_UPPER}_FOUND FALSE) + ENDIF(NOT ${_CURRENT_VAR}) + ENDFOREACH(_CURRENT_VAR) + + IF (${_NAME_UPPER}_FOUND) + IF (NOT ${_NAME}_FIND_QUIETLY) + MESSAGE(STATUS "Found ${_NAME}: ${${_VAR1}}") + ENDIF (NOT ${_NAME}_FIND_QUIETLY) + ELSE (${_NAME_UPPER}_FOUND) + IF (${_NAME}_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "${_FAIL_MESSAGE}") + ELSE (${_NAME}_FIND_REQUIRED) + IF (NOT ${_NAME}_FIND_QUIETLY) + MESSAGE(STATUS "${_FAIL_MESSAGE}") + ENDIF (NOT ${_NAME}_FIND_QUIETLY) + ENDIF (${_NAME}_FIND_REQUIRED) + ENDIF (${_NAME_UPPER}_FOUND) +ENDMACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS) diff --git a/cmake/Modules/FindPythonModule.cmake b/cmake/Modules/FindPythonModule.cmake new file mode 100644 index 000000000..b888216e3 --- /dev/null +++ b/cmake/Modules/FindPythonModule.cmake @@ -0,0 +1,36 @@ +# Find if a Python module is installed +# Found at http://www.cmake.org/pipermail/cmake/2011-January/041666.html +# To use do: find_python_module(PyQt4 REQUIRED) +# Dave found this on github at https://github.com/ivansafrin/Polycode/blob/master/CMake/FindPythonModule.cmake +# JMO modified to check PYTHON_VERSION and do the right thing for python 2.x. +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +function(find_python_module module) + string(TOUPPER ${module} module_upper) + #if(NOT PY_${module_upper}) + #message("running") + if(ARGC GREATER 1 AND ARGV1 STREQUAL "REQUIRED") + set(PY_${module}_FIND_REQUIRED TRUE) + endif() + if(ARGC GREATER 1 AND ARGV1 STREQUAL "QUIET") + set(PY_${module}_FIND_QUIETLY TRUE) + endif() + + # A module's location is usually a directory, but for binary modules it's a .so file. + if (${PYTHON_VERSION} VERSION_LESS "3.0") + set (CMDSTRING "import ${module}; print ${module}.__file__.replace('__init__.pyc', '')") + else() + set (CMDSTRING "import re, ${module}; print re.compile('/__init__.py.*').sub('',${module}.__file__)") + endif() + execute_process(COMMAND ${PYTHON_EXECUTABLE} "-c" "${CMDSTRING}" + RESULT_VARIABLE _${module}_status + OUTPUT_VARIABLE _${module}_location + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + #message("${_${module}_location}") + #if (NOT ${_${module}_status}) + set(PY_${module_upper} ${_${module}_location} CACHE STRING + "Location of Python module ${module}" FORCE) + #endif() + #endif() + find_package_handle_standard_args(PY_${module} DEFAULT_MSG PY_${module_upper}) +endfunction(find_python_module) diff --git a/cmake/Modules/FindPythonSitePackages.cmake b/cmake/Modules/FindPythonSitePackages.cmake new file mode 100644 index 000000000..ce9e6930b --- /dev/null +++ b/cmake/Modules/FindPythonSitePackages.cmake @@ -0,0 +1,16 @@ +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +function(find_python_site_packages) + if(PYTHON_EXECUTABLE) + set (CMDSTRING "from distutils.sysconfig import get_python_lib; print get_python_lib()") + execute_process(COMMAND ${PYTHON_EXECUTABLE} "-c" "${CMDSTRING}" + RESULT_VARIABLE _site_packages_status + OUTPUT_VARIABLE _site_packages_location + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (NOT _site_packages_status) + set(PYTHON_SITE_PACKAGES ${_site_packages_location} + CACHE STRING "Python site-packages directory lcoation" FORCE) + message(STATUS "Python site-packages located at ${PYTHON_SITE_PACKAGES}") + endif() + endif() +endfunction(find_python_site_packages) diff --git a/cmake/Modules/FindPythonVersion.cmake b/cmake/Modules/FindPythonVersion.cmake new file mode 100644 index 000000000..d23b96c90 --- /dev/null +++ b/cmake/Modules/FindPythonVersion.cmake @@ -0,0 +1,27 @@ +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +function(find_python_version) + if(PYTHON_EXECUTABLE) + set(CMDSTRING "import sys; print sys.version.split(' ')[0].split('rc')[0]") + execute_process(COMMAND ${PYTHON_EXECUTABLE} "-c" "${CMDSTRING}" + RESULT_VARIABLE _python_version_status + OUTPUT_VARIABLE _python_version_string + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (NOT _python_version_status) + # Break full version into major.minor.patch based on how cmake does version checking + STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" _major "${_python_version_string}") + STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" _minor "${_python_version_string}") + STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9])+" "\\1" _patch "${_python_version_string}") + + # Store the major.minor version for later use + set(PYTHON_VERSION "${_major}.${_minor}" + CACHE STRING "Python major.minor version number" FORCE) + + # For backward compatibility to cmake's find_package(PythonInterp) + set(PYTHON_VERSION_STRING ${_python_version_string} + CACHE STRING "Python major.minor.patch version number" FORCE) + + message(STATUS "Python major/minor version number is ${PYTHON_VERSION}") + endif() + endif() +endfunction(find_python_version) \ No newline at end of file diff --git a/cmake/Modules/SpheralCMake.cmake b/cmake/Modules/SpheralCMake.cmake new file mode 100644 index 000000000..94bf2b1e4 --- /dev/null +++ b/cmake/Modules/SpheralCMake.cmake @@ -0,0 +1,19 @@ +function(spheral_add_cxx_library package_name) + if(ENABLE_STATIC_CXXONLY) + blt_add_library(NAME Spheral_${package_name} + HEADERS ${${package_name}_headers} + SOURCES ${${package_name}_sources} + DEPENDS_ON ${spheral_depends} + SHARED FALSE + ) + else() + blt_add_library(NAME Spheral_${package_name} + HEADERS ${${package_name}_headers} + SOURCES ${${package_name}_sources} + DEPENDS_ON ${spheral_depends} + SHARED TRUE + ) + endif() +endfunction() + + diff --git a/cmake/Modules/UsePYB11Generator.cmake b/cmake/Modules/UsePYB11Generator.cmake new file mode 100644 index 000000000..31f2c43cc --- /dev/null +++ b/cmake/Modules/UsePYB11Generator.cmake @@ -0,0 +1,116 @@ +#----------------------------------------------------------------------------------- +# - A Python-wrapping module for CMake using PYB11Generator/pybind11 +# +# Modified from the UseSWIG module from the cmake2.8 release. +# +# Defines the following macros: +# PYB11_GENERATE_BINDINGS(module_name module_list) +# - Generates the Python bindings for each module in the list +# +# Internal macros to do the work: +# PYB11_REGISTER_MODULE(name) +# - Builds list of Python source code and generated C++ code +# +# +# Variables that must be set before calling PYB11_GENERATE_BINDINGS: +# PYB11_DIR +# - Location of the python source code to build the bindings +# PYTHON_EXECUTABLE +# - Python executable +# PYTHON_LIB_DIR +# - Python lib (typically obtained from the executable root) +# +# Optional variables +# PYB11_ADDITIONAL_ARGS +# - Additional arguments to follow the command in PYB11_GENERATE_BINDINGS +# +# To get the names of the generated source +# use: ${PYB11_GENERATED_SOURCE} +#----------------------------------------------------------------------------------- + +# Initialize the list of Python source code +set(PYB11_SOURCE) + +# Initialize the list of C++ code generated by PYB11Generator +set(PYB11_GENERATED_SOURCE) + +# +# INTERNAL: Build up the lists of source files and generated files to track +# outputs and dependencies for the build +# +macro(PYB11_REGISTER_MODULE _module) + if (EXISTS "${PYB11_DIR}/${_module}MOD.py") + set(_source "${PYB11_DIR}/${_module}MOD.py") + else() + if (EXISTS "${PROJECT_BINARY_DIR}/src/PYB11/${_module}MOD.py") + set(_source "${PROJECT_BINARY_DIR}/src/PYB11/${_module}MOD.py") + else() + message(FATAL_ERROR "Could not find source file ${_module}MOD.py") + endif() + endif() + list(APPEND PYB11_SOURCE ${_source}) + list(APPEND PYB11_GENERATED_SOURCE "${PYB11_MODULE_NAME}_${_module}.cc") +endmacro() + +# +# Runs "python polytopeMOD.py" to generate the bindings. +# This is where the PYB11Generator module is actually used. Calls the previous +# internal macros to generate the source file lists +# +macro(PYB11_GENERATE_BINDINGS) + set(PYB11_GENERATED_SOURCE) + list(APPEND PYB11_SOURCE "${PYB11_MODULE_NAME}MOD.py") + list(APPEND PYB11_GENERATED_SOURCE "${PYB11_MODULE_NAME}.cc") + + set(PYTHON_ENV + "${PROJECT_SOURCE_DIR}/Pybind11Wraps:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/${PYB11_MODULE_NAME}:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/polytope:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/Distributed:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/OpenMP:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/CXXTypes:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/Geometry:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/PolyClipper:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/Silo:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/DataOutput:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/NodeList:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/Field:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/FieldList:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/Kernel:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/Neighbor:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/Material:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/FileIO:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/DataBase:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/Boundary:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/Physics:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/Hydro:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/ExternalForce:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/Gravity:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/Integrator:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/Utilities:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/NodeGenerators:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/FieldOperations:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/SPH:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/RK:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/CRKSPH:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/ArtificialViscosity:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/SVPH:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/Mesh:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/Damage:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/SolidMaterial:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/Strength:" + "${PROJECT_SOURCE_DIR}/Pybind11Wraps/ArtificialConduction:" + "${PROJECT_SOURCE_DIR}/SimulationControl:" + ) + STRING(REPLACE ";" "<->" PYTHON_ENV_STR ${PYTHON_ENV}) + + add_custom_command( + OUTPUT Spheral${PYB11_GENERATED_SOURCE} ${PYB11_GENERATED_HEADER} + COMMAND env PYTHONPATH=\"${PYTHON_ENV_STR}\" + ${PYTHON_EXECUTABLE} -c + 'from PYB11Generator import * \; + import ${PYB11_MODULE_NAME}MOD \; + PYB11generateModule(${PYB11_MODULE_NAME}MOD, \"Spheral${PYB11_MODULE_NAME}\") ' + DEPENDS ${PYB11_SOURCE} + ) +endmacro() diff --git a/cmake/SetupLibraries.cmake b/cmake/SetupLibraries.cmake deleted file mode 100644 index 76baeecaa..000000000 --- a/cmake/SetupLibraries.cmake +++ /dev/null @@ -1,106 +0,0 @@ -################################ -# SILO -################################ -if (SILO_DIR) - include(cmake/libraries/FindSILO.cmake) - if (SILO_FOUND) - blt_register_library( NAME silo - INCLUDES ${SILO_INCLUDE_DIRS} - LIBRARIES ${SILO_LIBRARY} - DEPENDS_ON hdf5 - DEFINES HAVE_SILO=1 ) - else() - message(FATAL_ERROR "Unable to find SILO with given path.") - endif() -else() - message(STATUS "Library Disabled: SILO") - set(BLT_SILO_DEFINES "HAVE_SILO=0" CACHE PATH "") -endif() - -################################ -# HDF5 -################################ -if (HDF5_DIR) - include(cmake/libraries/FindHDF5.cmake) - if (HDF5_FOUND) - blt_register_library( NAME hdf5 - INCLUDES ${HDF5_INCLUDE_DIRS} - LIBRARIES ${HDF5_LIBRARIES} - DEFINES HAVE_HDF5=1 ) - else() - message(FATAL_ERROR "Unable to find HDF5 with given path.") - endif() -else() - message(STATUS "Library Disabled: HDF5") - set(BLT_HDF5_DEFINES "HAVE_HDF5=0" CACHE PATH "") -endif() - -################################ -# BOOST -################################ -if (BOOST_DIR) - include(cmake/libraries/FindBOOST.cmake) - if (BOOST_FOUND) - blt_register_library( NAME BOOST - INCLUDES ${BOOST_INCLUDE_DIRS} - DEFINES HAVE_BOOST=1 ) - else() - message(FATAL_ERROR "Unable to find BOOST with given path.") - endif() -else() - message(STATUS "Library Disabled: BOOST") - set(BLT_BOOST_DEFINES "HAVE_BOOST=0" CACHE PATH "") -endif() - -################################ -# EIGEN -################################ -if (EIGEN_DIR) - include(cmake/libraries/FindEigen.cmake) - if (EIGEN_FOUND) - blt_register_library( NAME eigen - INCLUDES ${EIGEN_INCLUDE_DIRS} - DEFINES HAVE_EIGEN=1 ) - else() - message(FATAL_ERROR "Unable to find EIGEN with given path.") - endif() -else() - message(STATUS "Library Disabled: EIGEN") - set(BLT_EIGEN_DEFINES "HAVE_EIGEN=0" CACHE PATH "") -endif() - -################################ -# QHULL -################################ -if (QHULL_DIR) - include(cmake/libraries/FindQhull.cmake) - if (QHULL_FOUND) - blt_register_library( NAME qhull - INCLUDES ${QHULL_INCLUDE_DIRS} - LIBRARIES ${QHULL_LIBRARY} - DEFINES HAVE_QHULL=1 ) - else() - message(FATAL_ERROR "Unable to find QHULL with given path.") - endif() -else() - message(STATUS "Library Disabled: QHULL") - set(BLT_QHULL_DEFINES "HAVE_QHULL=0" CACHE PATH "") -endif() - -################################ -# POLYTOPE -################################ -if (POLYTOPE_DIR) - include(cmake/libraries/FindPolytope.cmake) - if (POLYTOPE_FOUND) - blt_register_library( NAME polytope - INCLUDES ${POLYTOPE_INCLUDE_DIRS} - LIBRARIES ${POLYTOPE_LIBRARY} - DEFINES HAVE_POLYTOPE=1 ) - else() - message(FATAL_ERROR "Unable to find POLYTOPE with given path.") - endif() -else() - message(STATUS "Library Disabled: POLYTOPE") - set(BLT_POLYTOPE_DEFINES "HAVE_POLYTOPE=0" CACHE PATH "") -endif() diff --git a/cmake/blt b/cmake/blt new file mode 160000 index 000000000..eb6c46a8b --- /dev/null +++ b/cmake/blt @@ -0,0 +1 @@ +Subproject commit eb6c46a8b72e643e22a1d06d94864d4c69509e4f diff --git a/cmake/libraries/FindEigen.cmake b/cmake/libraries/FindEigen.cmake index 93e790b81..29b15770f 100644 --- a/cmake/libraries/FindEigen.cmake +++ b/cmake/libraries/FindEigen.cmake @@ -13,8 +13,8 @@ if(NOT EIGEN_DIR) endif() #find includes -find_path( EIGEN_INCLUDE_DIRS Eigen - PATHS ${EIGEN_DIR}/include +find_path( EIGEN_INCLUDE_DIRS Eigen/Eigen + PATHS ${EIGEN_DIR}/include/eigen3/ NO_DEFAULT_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_PATH diff --git a/cmake/libraries/FindPolytope.cmake b/cmake/libraries/FindPolytope.cmake index 769f89c98..3919a9b98 100644 --- a/cmake/libraries/FindPolytope.cmake +++ b/cmake/libraries/FindPolytope.cmake @@ -36,3 +36,10 @@ include(FindPackageHandleStandardArgs) find_package_handle_standard_args(POLYTOPE DEFAULT_MSG POLYTOPE_INCLUDE_DIRS POLYTOPE_LIBRARY ) + +if(NOT ENABLE_CXXONLY AND NOT ENABLE_STATIC_CXXONLY) + install( + FILES ${POLYTOPE_DIR}/lib/python2.7/site-packages/polytope/polytope.so + DESTINATION . + ) +endif() diff --git a/cmake/libraries/FindPybind11.cmake b/cmake/libraries/FindPybind11.cmake new file mode 100644 index 000000000..d53a111a3 --- /dev/null +++ b/cmake/libraries/FindPybind11.cmake @@ -0,0 +1,28 @@ +############################################################################### +# +# Setup Pybind11 +# This file defines: +# PYBIND11_FOUND - If Pybind11 was found +# PYBIND11_INCLUDE_DIRS - The Pybind11 include directories +# PYBIND11_LIBRARY - The Pybind11 library + +# first Check for PYBIND11_DIR + +if(NOT PYBIND11_DIR) + MESSAGE(FATAL_ERROR "Could not find PYBIND11. PYBIND11 support needs explicit PYBIND11_DIR") +endif() + +#find includes +find_path( PYBIND11_INCLUDE_DIRS pybind11 + PATHS ${PYBIND11_DIR}/include + NO_DEFAULT_PATH + NO_CMAKE_ENVIRONMENT_PATH + NO_CMAKE_PATH + NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set PYBIND11_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(PYBIND11 DEFAULT_MSG + PYBIND11_INCLUDE_DIRS ) diff --git a/cmake/libraries/FindPython.cmake b/cmake/libraries/FindPython.cmake new file mode 100644 index 000000000..85821c99f --- /dev/null +++ b/cmake/libraries/FindPython.cmake @@ -0,0 +1,48 @@ +# Find Python +option(USE_PYTHON "Generate Python interface" ON) +if (USE_PYTHON) + set(Python_ADDITIONAL_VERSIONS 2.7) + if (PYTHON_EXE) + set(PYTHON_EXECUTABLE ${PYTHON_EXE}) + include(FindPythonVersion) + find_python_version() + find_package(PythonLibs) + string(REPLACE "/bin/python${PYTHON_VERSION}" "" PYTHON_ROOT ${PYTHON_EXE}) + set(PYTHON_INCLUDE_DIR "${PYTHON_ROOT}/include/site/python${PYTHON_VERSION}") + set(PYTHON_INCLUDE_DIRS "${PYTHON_ROOT}/include/python${PYTHON_VERSION}") + set(PYTHON_LIB_DIR "${PYTHON_ROOT}/lib") + set(PYTHON_LIBRARY "${PYTHON_LIB_DIR}/libpython.a") + else() + find_package(PythonLibs REQUIRED) + find_package(PythonInterp REQUIRED) + set(PYTHON_VERSION "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") + endif() + + if (PYTHON_EXECUTABLE) + include(FindPythonModule) + find_python_module(PYB11Generator REQUIRED) + find_python_module(mpi4py REQUIRED) + find_python_module(pybind11 REQUIRED) + find_python_module(matplotlib REQUIRED) + find_python_module(Gnuplot REQUIRED) + find_python_module(stl REQUIRED) + set(PY_PYB11 1) + include_directories("${PYTHON_INCLUDE_DIR}") + include_directories("${PYTHON_INCLUDE_DIRS}") + if (PY_PYB11) + set(HAVE_PYTHON ON) + message(STATUS "Found Python version ${PYTHON_VERSION}") + message(STATUS "Using Python executable ${PYTHON_EXECUTABLE}") + else() + set(HAVE_PYTHON OFF) + endif() + endif() + + if (HAVE_PYTHON) + include(FindPythonSitePackages) + find_python_site_packages() + endif() +else() + set(HAVE_PYTHON OFF) +endif() + diff --git a/src/ArtificialConduction/CMakeLists.txt b/src/ArtificialConduction/CMakeLists.txt new file mode 100644 index 000000000..ed00c4bf0 --- /dev/null +++ b/src/ArtificialConduction/CMakeLists.txt @@ -0,0 +1,28 @@ +include_directories(.) +set(ArtificialConduction_inst + ArtificialConduction + ArtificialConductionPolicy + ) + +set(ArtificialConduction_sources ) +instantiate(ArtificialConduction_inst ArtificialConduction_sources) + +set(ArtificialConduction_headers + ArtificialConduction.hh + ArtificialConductionPolicy.hh + ) + +spheral_add_cxx_library(ArtificialConduction) + +install(TARGETS Spheral_ArtificialConduction + EXPORT ${PROJECT_NAME}-targets + DESTINATION lib + INCLUDES DESTINATION include + ) + +install(FILES ${ArtificialConduction_headers} + DESTINATION include/ArtificialConduction + ) + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_ArtificialConduction) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/ArtificialViscosity/CMakeLists.txt b/src/ArtificialViscosity/CMakeLists.txt index e1c2e279f..34b3637f1 100644 --- a/src/ArtificialViscosity/CMakeLists.txt +++ b/src/ArtificialViscosity/CMakeLists.txt @@ -1,10 +1,16 @@ - +include_directories(.) set(ArtificialViscosity_inst ArtificialViscosity CRKSPHMonaghanGingoldViscosity + CullenDehnenViscosity + FiniteVolumeViscosity + IncrementCullenMultipliers MonaghanGingoldViscosity + MorrisMonaghanReducingViscosity + TensorSVPHViscosity TensorCRKSPHViscosity TensorMonaghanGingoldViscosity + VonNeumanViscosity ) @@ -24,6 +30,8 @@ set(ArtificialViscosity_headers ArtificialViscosityList.hh CRKSPHMonaghanGingoldViscosity.hh CRKSPHMonaghanGingoldViscosityRZ.hh + CullenDehnenViscosity.hh + FiniteVolumeViscosity.hh MonaghanGingoldViscosity.hh MonaghanGingoldViscosityGSRZ.hh MonaghanGingoldViscosityRZ.hh @@ -31,11 +39,7 @@ set(ArtificialViscosity_headers TensorMonaghanGingoldViscosity.hh ) -blt_add_library(NAME Spheral_ArtificialViscosity - SOURCES ${ArtificialViscosity_sources} - HEADERS ${ArtificialViscosity_headers} - DEPENDS_ON ${spheral_depends} - ) +spheral_add_cxx_library(ArtificialViscosity) install(TARGETS Spheral_ArtificialViscosity EXPORT ${PROJECT_NAME}-targets @@ -46,3 +50,6 @@ install(TARGETS Spheral_ArtificialViscosity install(FILES ${ArtificialViscosity_headers} DESTINATION include/ArtificialViscosity ) + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_ArtificialViscosity) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/Boundary/CMakeLists.txt b/src/Boundary/CMakeLists.txt index 39e602ca9..dec06ab96 100644 --- a/src/Boundary/CMakeLists.txt +++ b/src/Boundary/CMakeLists.txt @@ -1,15 +1,24 @@ +include_directories(.) set(Boundary_inst Boundary CRKSPHVoidBoundary - findNodesTouchingThroughPlanes - PeriodicBoundary PlanarBoundary ReflectingBoundary RigidBoundary + PeriodicBoundary + ConstantVelocityBoundary + ConstantXVelocityBoundary + ConstantYVelocityBoundary + ConstantRVelocityBoundary + ConstantBoundary + findNodesTouchingThroughPlanes + InflowOutflowBoundary ) -set(Boundary_sources ) +set(Boundary_sources + FacetedVolumeBoundary.cc + ) if(ENABLE_2D) list(APPEND Boundary_sources @@ -17,30 +26,34 @@ if(ENABLE_2D) ) endif() +if(ENABLE_3D) + list(APPEND Boundary_sources + CylindricalBoundary.cc + SphericalBoundary.cc + ConstantZVelocityBoundaryInst.cc + AxisBoundaryRZ.cc + ) +endif() + instantiate(Boundary_inst Boundary_sources) set(Boundary_headers + #AxialSymmetryBoundary.hh AxisBoundaryRZ.hh Boundary.hh BoundaryInline.hh CRKSPHVoidBoundary.hh - findNodesTouchingThroughPlanes.hh - PeriodicBoundary.hh - PeriodicPlanarBoundary.hh PlanarBoundary.hh PlanarBoundaryInline.hh PlanarSymmetryBoundary.hh ReflectingBoundary.hh ReflectingBoundaryInline.hh RigidBoundary.hh + #RigidBoundaryInline.hh mapPositionThroughPlanes.hh ) -blt_add_library(NAME Spheral_Boundary - SOURCES ${Boundary_sources} - HEADERS ${Boundary_headers} - DEPENDS_ON ${spheral_depends} - ) +spheral_add_cxx_library(Boundary) install(TARGETS Spheral_Boundary EXPORT ${PROJECT_NAME}-targets @@ -51,3 +64,6 @@ install(TARGETS Spheral_Boundary install(FILES ${Boundary_headers} DESTINATION include/Boundary ) + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_Boundary) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0307af8d7..a3a8f7f8b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,34 +1,133 @@ -# Libraries +# CMakeLists to build the Spheral library. +cmake_minimum_required(VERSION 3.4) +project(spheral LANGUAGES CXX) + +################################ +# Configure CMake +################################ +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w") +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../cmake/Modules") +include(${CMAKE_MODULE_PATH}/SpheralCMake.cmake) + +################################ +# Configure and Include blt +################################ +set(ENABLE_MPI ON CACHE BOOL "") +set(ENABLE_OPENMP ON CACHE BOOL "") + +set (SPHERAL_BLT_REL_DIR "${PROJECT_SOURCE_DIR}/../cmake/blt" CACHE PATH "") +get_filename_component(SPHERAL_BLT_DIR "${SPHERAL_BLT_REL_DIR}" ABSOLUTE) + +if (NOT EXISTS "${PROJECT_SOURCE_DIR}/../cmake/blt/SetupBLT.cmake") + message(FATAL_ERROR + "${SPHERAL_BLT_DIR} is not present.\n" + "call cmake with -DSPHERAL_BLT_DIR=/your/installation/of/blt\n") +endif() + +include(${PROJECT_SOURCE_DIR}/../cmake/blt/SetupBLT.cmake) + +################################ +# Install / Locate third party libraries +################################ +set(SPHERAL_INSTALL_DIR) +option(INSTALL_TPLS "download and install third party libs" ON) +include(../cmake/InstallLibraries.cmake) +set(spheral_depends BOOST Eigen qhull silo polytope pybind11) + + +################################ +# Include standard build system logic and options / definitions +################################ +option(ENABLE_CXXONLY "enable C++ only build without python bindings" OFF) +option(ENABLE_2D "enable 2d" ON) +option(ENABLE_3D "enable 3d" ON) +option(ENABLE_INSTANTIATIONS "enable instantiations" ON) +option(ENABLE_STATIC_CXXONLY "build only static libs" OFF) +option(ENABLE_TIMER "enable timer" OFF) + +if(ENABLE_STATIC_CXXONLY) + set(ENABLE_CXXONLY ON) +endif() + +if(ENABLE_CXXONLY) + set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/Spheral) + if(SPHERAL_INSTALL_DIR) + set(CMAKE_INSTALL_PREFIX ${SPHERAL_INSTALL_DIR}) + endif() +else() + set(CMAKE_INSTALL_PREFIX ${PYTHON_SITE_PACKAGE_DIR}/Spheral) +endif() + +if(ENABLE_MPI) + set(BLT_MPI_COMPILE_FLAGS -DUSE_MPI -DMPICH_SKIP_MPICXX -ULAM_WANT_MPI2CPP -DOMPI_SKIP_MPICXX) + list(APPEND spheral_depends mpi) +endif() + +if(ENABLE_OPENMP) + list(APPEND spheral_depends openmp) +endif() + + +include(../cmake/CMakeBasics.cmake) + + +################################ +# Build spheral packages +################################ include_directories(.) -set(spheral_depends BOOST Eigen qhull silo polytope mpi openmp) - -add_subdirectory(CInterface) -set(_packages SPH - CRKSPH - ArtificialViscosity - Boundary - Damage - DataBase - DataOutput - Distributed - Integrator - Kernel - Strength - SolidMaterial - Material - Mesh - Neighbor - Hydro - Physics - FileIO - Field - FieldOperations - NodeGenerators - NodeList - Geometry - Utilities - ) +set(SPHERAL_PYTHON_DEPENDS ) + +set(SPHERAL_PYTHON_INSTALL ${PROJECT_BINARY_DIR}/lib) + +set(_packages + ArtificialViscosity + ArtificialConduction + Boundary + CRKSPH + Damage + DataBase + DataOutput + Distributed + ExternalForce + Field + FieldOperations + FileIO + Geometry + Gravity + Hydro + Integrator + Kernel + Material + Mesh + Neighbor + NodeGenerators + NodeList + Physics + RK + SolidMaterial + SPH + Strength + SVPH + Utilities + ) + +if(NOT ENABLE_CXXONLY) + list(APPEND _packages + PythonMPIInterfaces + SimulationControl + Pybind11Wraps + ) +endif() + +if(NOT ENABLE_MPI) + list(REMOVE_ITEM _packages + Distributed + ) +endif() foreach(_package ${_packages}) add_subdirectory(${_package}) endforeach() + +install(EXPORT ${PROJECT_NAME}-targets DESTINATION lib/cmake) diff --git a/src/CRKSPH/CMakeLists.txt b/src/CRKSPH/CMakeLists.txt index 675bdd5dc..0b5a7013c 100644 --- a/src/CRKSPH/CMakeLists.txt +++ b/src/CRKSPH/CMakeLists.txt @@ -1,32 +1,17 @@ +include_directories(.) set(CRKSPH_inst - CRKSPHHydroBase - ContinuityVolumePolicy - SolidCRKSPHHydroBase - computeCRKSPHCorrections - computeCRKSPHEvaluation - computeCRKSPHIntegral - computeCRKSPHMoments computeCRKSPHSumMassDensity - computeCRKSPHSumVolume - computeHVolumes - computeHullVolumes - computeRKVolumes computeSolidCRKSPHSumMassDensity + CRKSPHHydroBase detectSurface + SolidCRKSPHHydroBase editMultimaterialSurfaceTopology - gradientCRKSPH - interpolateCRKSPH zerothOrderSurfaceCorrections - RKCorrections - RKUtilities ) set(CRKSPH_sources centerOfMass.cc - ContinuityVolumePolicyRZ.cc - computeVoronoiVolume.cc - computeVoronoiVolume1d.cc ) if(ENABLE_2D) @@ -36,52 +21,37 @@ if(ENABLE_2D) ) endif() +if(ENABLE_3D) + list(APPEND CRKSPH_sources + ) +endif() + instantiate(CRKSPH_inst CRKSPH_sources) set(CRKSPH_headers - CRKSPHCorrectionParams.hh CRKSPHHydroBase.hh CRKSPHHydroBaseInline.hh CRKSPHHydroBaseRZ.hh - CRKSPHUtilities.hh - CRKSPHUtilitiesInline.hh - ContinuityVolumePolicy.hh - ContinuityVolumePolicyRZ.hh - HullVolumePolicy.hh SolidCRKSPHHydroBase.hh SolidCRKSPHHydroBaseInline.hh SolidCRKSPHHydroBaseRZ.hh - SurfaceNodeCoupling.hh centerOfMass.hh - computeCRKSPHCorrections.hh computeCRKSPHEvaluation.hh computeCRKSPHIntegral.hh - computeCRKSPHMoments.hh computeCRKSPHSumMassDensity.hh - computeCRKSPHSumVolume.hh - computeHVolumes.hh computeHullSumMassDensity.hh - computeHullVolumes.hh - computeRKVolumes.hh computeSolidCRKSPHSumMassDensity.hh computeVoronoiCentroids.hh - computeVoronoiVolume.hh detectSurface.hh - editMultimaterialSurfaceTopology.hh - gradientCRKSPH.hh - interpolateCRKSPH.hh volumeSpacing.hh zerothOrderSurfaceCorrections.hh - RKCorrections.hh - RKUtilities.hh - RKUtilitiesInline.hh ) -blt_add_library(NAME Spheral_CRKSPH - SOURCES ${CRKSPH_sources} - HEADERS ${CRKSPH_headers} - DEPENDS_ON ${spheral_depends} - ) +set(CRKSPH_python_targets + CRKSPHHydros.py + ) + +spheral_add_cxx_library(CRKSPH) install(TARGETS Spheral_CRKSPH EXPORT ${PROJECT_NAME}-targets @@ -92,3 +62,12 @@ install(TARGETS Spheral_CRKSPH install(FILES ${CRKSPH_headers} DESTINATION include/CRKSPH ) + +if(NOT ENABLE_CXXONLY) + install(FILES ${CRKSPH_python_targets} + DESTINATION . + ) +endif() + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_CRKSPH) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/CXXTests/CMakeLists.txt b/src/CXXTests/CMakeLists.txt new file mode 100644 index 000000000..f474090e1 --- /dev/null +++ b/src/CXXTests/CMakeLists.txt @@ -0,0 +1,44 @@ +set(CXXTests_inst + #testNodeIterators + ) + +set(CXXTests_sources + #test_r3d_utils.cc + #testNodeIterators.cc + ) + +instantiate(CXXTests_inst CXXTests_sources) + +set(CXXTests_headers + #test_r3d_utils.hh + testFieldListIndexing.hh + testNewtonRaphson.hh + #testNodeIterators.hh + ) + +set(CXXTests_includes + ${SPHERAL_SOURCE_DIR} + ${SPHERAL_SOURCE_DIR}/CXXTests + ${EIGEN_LIB_LOCATION} + ) + + +blt_add_library(NAME Spheral_CXXTests + HEADERS ${CXXTests_headers} + SOURCES ${CXXTests_sources} + DEPENDS_ON ${spheral_depends} + INCLUDES ${CXXTests_includes} + ) + +install(TARGETS Spheral_CXXTests + EXPORT ${PROJECT_NAME}-targets + DESTINATION lib + INCLUDES DESTINATION include + ) + +install(FILES ${CXXTests_headers} + DESTINATION include/CXXTests + ) + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_CXXTests) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/Damage/CMakeLists.txt b/src/Damage/CMakeLists.txt index 8aaf41c47..228197069 100644 --- a/src/Damage/CMakeLists.txt +++ b/src/Damage/CMakeLists.txt @@ -1,5 +1,17 @@ +include_directories(.) set(Damage_inst + DamageModel + TensorDamageModel + StrainPolicy + TensorStrainPolicy + TensorDamagePolicy + YoungsModulusPolicy + LongitudinalSoundSpeedPolicy + weibullFlawDistribution computeFragmentField + JohnsonCookDamage + JohnsonCookFailureStrainPolicy + JohnsonCookDamagePolicy ) @@ -9,13 +21,37 @@ instantiate(Damage_inst Damage_sources) set(Damage_headers computeFragmentField.hh + DamagedSoundSpeedPolicy.hh + DamageGradientPolicy.hh + DamageModel.hh + DamageModelInline.hh + EffectiveTensorDamagePolicy.hh + GradyKippScalarDamage.hh + JohnsonCookDamage.hh + JohnsonCookDamageInline.hh + JohnsonCookDamagePolicy.hh + JohnsonCookFailureStrainPolicy.hh + LongitudinalSoundSpeedPolicy.hh + oneMinusDamage.hh + ScalarDamageModel.hh + ScalarDamagePolicy.hh + StrainPolicy.hh + TensorDamageModel.hh + TensorDamageModelInline.hh + TensorDamagePolicy.hh + TensorStrainPolicy.hh + weibullFlawDistribution.hh + YoungsModulusPolicy.hh ) -blt_add_library(NAME Spheral_Damage - SOURCES ${Damage_sources} - HEADERS ${Damage_headers} - DEPENDS_ON ${spheral_depends} - ) +set(Damage_python_targets + identifyFragments.py + WeibullDamage.py + GradyKippTensorDamage.py + JohnsonCookDamageFactories.py + ) + +spheral_add_cxx_library(Damage) install(TARGETS Spheral_Damage EXPORT ${PROJECT_NAME}-targets @@ -26,3 +62,12 @@ install(TARGETS Spheral_Damage install(FILES ${Damage_headers} DESTINATION include/Damage ) + +if(NOT ENABLE_CXXONLY) + install(FILES ${Damage_python_targets} + DESTINATION . + ) +endif() + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_Damage) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/DataBase/CMakeLists.txt b/src/DataBase/CMakeLists.txt index 309cf0959..31774996f 100644 --- a/src/DataBase/CMakeLists.txt +++ b/src/DataBase/CMakeLists.txt @@ -1,3 +1,4 @@ +include_directories(.) set(DataBase_inst CompositeFieldListPolicy CopyFieldList @@ -53,11 +54,7 @@ set(DataBase_headers UpdatePolicyBaseInline.hh ) -blt_add_library(NAME Spheral_DataBase - SOURCES ${DataBase_sources} - HEADERS ${DataBase_headers} - DEPENDS_ON ${spheral_depends} - ) +spheral_add_cxx_library(DataBase) install(TARGETS Spheral_DataBase EXPORT ${PROJECT_NAME}-targets @@ -68,3 +65,6 @@ install(TARGETS Spheral_DataBase install(FILES ${DataBase_headers} DESTINATION include/DataBase ) + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_DataBase) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/DataOutput/CMakeLists.txt b/src/DataOutput/CMakeLists.txt index 9fe073431..7e16a267b 100644 --- a/src/DataOutput/CMakeLists.txt +++ b/src/DataOutput/CMakeLists.txt @@ -1,5 +1,7 @@ +include_directories(.) set(DataOutput_sources RestartRegistrar.cc + #RestartableObject.cc ) set(DataOutput_headers @@ -11,11 +13,7 @@ set(DataOutput_headers registerWithRestart.hh ) -blt_add_library(NAME Spheral_DataOutput - SOURCES ${DataOutput_sources} - HEADERS ${DataOutput_headers} - DEPENDS_ON ${spheral_depends} - ) +spheral_add_cxx_library(DataOutput) install(TARGETS Spheral_DataOutput EXPORT ${PROJECT_NAME}-targets @@ -26,3 +24,6 @@ install(TARGETS Spheral_DataOutput install(FILES ${DataOutput_headers} DESTINATION include/DataOutput ) + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_DataOutput) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/Distributed/CMakeLists.txt b/src/Distributed/CMakeLists.txt index def78dd65..ac9a831f8 100644 --- a/src/Distributed/CMakeLists.txt +++ b/src/Distributed/CMakeLists.txt @@ -1,5 +1,9 @@ +include_directories(.) set(Distributed_sources Communicator.cc + SortAndDivideRedistributeNodes1d.cc + SortAndDivideRedistributeNodes2d.cc + SortAndDivideRedistributeNodes3d.cc ) if (ENABLE_MPI) @@ -7,13 +11,20 @@ if (ENABLE_MPI) waitAllWithDeadlockDetection.cc ) +endif() set(Distributed_inst - DistributedBoundary - NestedGridDistributedBoundary - RedistributeNodes - TreeDistributedBoundary + DistributedBoundary + NestedGridDistributedBoundary + TreeDistributedBoundary + BoundingVolumeDistributedBoundary + RedistributeNodes + DistributeByXPosition + SortAndDivideRedistributeNodes + SpaceFillingCurveRedistributeNodes + MortonOrderRedistributeNodes + PeanoHilbertOrderRedistributeNodes + VoronoiRedistributeNodes ) -endif() instantiate(Distributed_inst Distributed_sources) @@ -22,19 +33,19 @@ set(Distributed_headers CompareDomainNodesByPosition.hh DistributedBoundary.hh DistributedBoundaryInline.hh + #DomainNode.hh + #DomainNodeInline.hh NestedGridDistributedBoundary.hh NestedGridUtilities.hh RedistributeNodes.hh RedistributeNodesInline.hh TreeDistributedBoundary.hh waitAllWithDeadlockDetection.hh + SortAndDivideRedistributeNodes.hh + SortAndDivideRedistributeNodes1d.hh ) -blt_add_library(NAME Spheral_Distributed - SOURCES ${Distributed_sources} - HEADERS ${Distributed_headers} - DEPENDS_ON ${spheral_depends} - ) +spheral_add_cxx_library(Distributed) install(TARGETS Spheral_Distributed EXPORT ${PROJECT_NAME}-targets @@ -45,3 +56,6 @@ install(TARGETS Spheral_Distributed install(FILES ${Distributed_headers} DESTINATION include/Distributed ) + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_Distributed) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/ExternalForce/CMakeLists.txt b/src/ExternalForce/CMakeLists.txt new file mode 100644 index 000000000..fdcdbf0c3 --- /dev/null +++ b/src/ExternalForce/CMakeLists.txt @@ -0,0 +1,43 @@ +include_directories(.) +set(ExternalForce_inst + ConstantAcceleration + LinearAcceleration + NFWPotential + PointPotential + ) + +set(ExternalForce_sources ) +instantiate(ExternalForce_inst ExternalForce_sources) + +set(ExternalForce_headers + ConstantAcceleration.hh + ConstantAccelerationInline.hh + LinearAcceleration.hh + LinearAccelerationInline.hh + NFWPotential.hh + NFWPotentialInline.hh + PointPotential.hh + PointPotentialInline.hh + ) + +set(ExternalForce_includes + ${SPHERAL_SOURCE_DIR} + ${SPHERAL_SOURCE_DIR}/ExternalForce + ${EIGEN_LIB_LOCATION} + ) + + +spheral_add_cxx_library(ExternalForce) + +install(TARGETS Spheral_ExternalForce + EXPORT ${PROJECT_NAME}-targets + DESTINATION lib + INCLUDES DESTINATION include + ) + +install(FILES ${ExternalForce_headers} + DESTINATION include/ExternalForce + ) + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_ExternalForce) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/FVCRKH/CMakeLists.txt b/src/FVCRKH/CMakeLists.txt new file mode 100644 index 000000000..b3fbc7544 --- /dev/null +++ b/src/FVCRKH/CMakeLists.txt @@ -0,0 +1,37 @@ +set(FVCRKH_inst + FVCRKHydroBase + ) + +set(FVCRKH_sources ) +instantiate(FVCRKH_inst FVCRKH_sources) + +set(FVCRKH_headers + FVCRKHydroBase.hh + ) + +set(FVCRKH_includes + ${SPHERAL_SOURCE_DIR} + ${SPHERAL_SOURCE_DIR}/FVCRKH + ${EIGEN_LIB_LOCATION} + ) + + +blt_add_library(NAME Spheral_FVCRKH + HEADERS ${FVCRKH_headers} + SOURCES ${FVCRKH_sources} + DEPENDS_ON ${spheral_depends} + INCLUDES ${FVCRKH_includes} + ) + +install(TARGETS Spheral_FVCRKH + EXPORT ${PROJECT_NAME}-targets + DESTINATION lib + INCLUDES DESTINATION include + ) + +install(FILES ${FVCRKH_headers} + DESTINATION include/FVCRKH + ) + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_FVCRKH) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/Field/CMakeLists.txt b/src/Field/CMakeLists.txt index 5915ca795..314a13c93 100644 --- a/src/Field/CMakeLists.txt +++ b/src/Field/CMakeLists.txt @@ -1,3 +1,4 @@ +include_directories(.) set(Field_inst AllNodeIterator CoarseNodeIterator @@ -29,7 +30,6 @@ set(Field_headers FieldListInline.hh FieldListSet.hh FieldListSetInline.hh - FieldListThreadWrapper.hh GhostNodeIterator.hh GhostNodeIteratorInline.hh InternalNodeIterator.hh @@ -44,11 +44,7 @@ set(Field_headers uvm_allocator.hh ) -blt_add_library(NAME Spheral_Field - SOURCES ${Field_sources} - HEADERS ${Field_headers} - DEPENDS_ON ${spheral_depends} - ) +spheral_add_cxx_library(Field) install(TARGETS Spheral_Field EXPORT ${PROJECT_NAME}-targets @@ -59,3 +55,6 @@ install(TARGETS Spheral_Field install(FILES ${Field_headers} DESTINATION include/Field ) + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_Field) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/FieldOperations/CMakeLists.txt b/src/FieldOperations/CMakeLists.txt index f6e64969c..61541d4e2 100644 --- a/src/FieldOperations/CMakeLists.txt +++ b/src/FieldOperations/CMakeLists.txt @@ -1,6 +1,27 @@ +include_directories(.) set(FieldOperations_inst + smoothFields + gradient + divergence + smoothFieldsMash + smoothFieldsMash2 + sampleFieldsMash + splatFieldsMash + gradientMash + divergenceMash + gradientPairWise + divergencePairWise + sampleMultipleFieldsMash + splatMultipleFieldsMash + gradDivVectorFieldList + gradDivVectorFieldListSimple + gradDivVectorFieldListGolden + gradDivVectorFieldListGolden2 + gradDivVectorFieldListMash + gradDivVectorFieldListPairWise sampleMultipleFields2Lattice sampleMultipleFields2LatticeMash + binFieldList2Lattice ) @@ -12,11 +33,7 @@ set(FieldOperations_headers sampleMultipleFields2Lattice.hh ) -blt_add_library(NAME Spheral_FieldOperations - SOURCES ${FieldOperations_sources} - HEADERS ${FieldOperations_headers} - DEPENDS_ON ${spheral_depends} - ) +spheral_add_cxx_library(FieldOperations) install(TARGETS Spheral_FieldOperations EXPORT ${PROJECT_NAME}-targets @@ -27,3 +44,6 @@ install(TARGETS Spheral_FieldOperations install(FILES ${FieldOperations_headers} DESTINATION include/FieldOperations ) + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_FieldOperations) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/FileIO/CMakeLists.txt b/src/FileIO/CMakeLists.txt index ed9a0f489..fae87fc38 100644 --- a/src/FileIO/CMakeLists.txt +++ b/src/FileIO/CMakeLists.txt @@ -1,5 +1,10 @@ +include_directories(.) set(FileIO_sources FileIO.cc + FlatFileIO.cc + SiloFileIO.cc + PyFileIO.cc + vectorstringUtilities.cc ) set(FileIO_headers @@ -11,11 +16,12 @@ set(FileIO_headers HDF5Types.hh ) -blt_add_library(NAME Spheral_FileIO - SOURCES ${FileIO_sources} - HEADERS ${FileIO_headers} - DEPENDS_ON ${spheral_depends} - ) +set(FileIO_python_targets + GzipFileIO.py + PlyFileIO.py + ) + +spheral_add_cxx_library(FileIO) install(TARGETS Spheral_FileIO EXPORT ${PROJECT_NAME}-targets @@ -26,3 +32,12 @@ install(TARGETS Spheral_FileIO install(FILES ${FileIO_headers} DESTINATION include/FileIO ) + +if(NOT ENABLE_CXXONLY) + install(FILES ${FileIO_python_targets} + DESTINATION . + ) +endif() + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_FileIO) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/Geometry/CMakeLists.txt b/src/Geometry/CMakeLists.txt index 72bc1e849..27d357468 100644 --- a/src/Geometry/CMakeLists.txt +++ b/src/Geometry/CMakeLists.txt @@ -1,3 +1,4 @@ +include_directories(.) set(Geometry_inst invertRankNTensor ) @@ -99,11 +100,7 @@ set(Geometry_headers polyclipper_utilities.hh ) -blt_add_library(NAME Spheral_Geometry - SOURCES ${Geometry_sources} ${Geometry_sources2d} ${Geometry_sources3d} - HEADERS ${Geometry_headers} - DEPENDS_ON ${spheral_depends} - ) +spheral_add_cxx_library(Geometry) install(TARGETS Spheral_Geometry EXPORT ${PROJECT_NAME}-targets @@ -114,3 +111,6 @@ install(TARGETS Spheral_Geometry install(FILES ${Geometry_headers} DESTINATION include/Geometry ) + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_Geometry) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/Gravity/CMakeLists.txt b/src/Gravity/CMakeLists.txt new file mode 100644 index 000000000..1fbd3b813 --- /dev/null +++ b/src/Gravity/CMakeLists.txt @@ -0,0 +1,35 @@ +include_directories(.) +set(Gravity_inst + CompatibleGravitationalVelocityPolicy + NBodyGravity + ) + +set(Gravity_sources + #LaplacianMatrixFactory.cc + TreeGravityInst.cc + ) +instantiate(Gravity_inst Gravity_sources) + +set(Gravity_headers + CompatibleGravitationalVelocityPolicy.hh + #LaplacianMatrixFactory.hh + NBodyGravity.hh + TreeGravity.hh + TreeGravityInline.hh + ) + + +spheral_add_cxx_library(Gravity) + +install(TARGETS Spheral_Gravity + EXPORT ${PROJECT_NAME}-targets + DESTINATION lib + INCLUDES DESTINATION include + ) + +install(FILES ${Gravity_headers} + DESTINATION include/Gravity + ) + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_Gravity) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/Hydro/CMakeLists.txt b/src/Hydro/CMakeLists.txt index 3fa3e9c6f..d596daa03 100644 --- a/src/Hydro/CMakeLists.txt +++ b/src/Hydro/CMakeLists.txt @@ -1,3 +1,4 @@ +include_directories(.) set(Hydro_inst EntropyPolicy NonSymmetricSpecificThermalEnergyPolicy @@ -9,11 +10,15 @@ set(Hydro_inst SumVoronoiMassDensityPolicy VolumePolicy VoronoiMassDensityPolicy + GammaPolicy + SecondMomentHourglassControl + ThirdMomentHourglassControl ) set(Hydro_sources HydroFieldNames.cc + RZNonSymmetricSpecificThermalEnergyPolicy.cc ) instantiate(Hydro_inst Hydro_sources) @@ -32,18 +37,12 @@ set(Hydro_headers SpecificFromTotalThermalEnergyPolicy.hh SpecificThermalEnergyPolicy.hh SumVoronoiMassDensityPolicy.hh - TotalHydro.hh - TotalHydroInline.hh VolumePolicy.hh VoronoiMassDensityPolicy.hh entropyWeightingFunction.hh ) -blt_add_library(NAME Spheral_Hydro - SOURCES ${Hydro_sources} - HEADERS ${Hydro_headers} - DEPENDS_ON ${spheral_depends} - ) +spheral_add_cxx_library(Hydro) install(TARGETS Spheral_Hydro EXPORT ${PROJECT_NAME}-targets @@ -54,3 +53,6 @@ install(TARGETS Spheral_Hydro install(FILES ${Hydro_headers} DESTINATION include/Hydro ) + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_Hydro) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/Integrator/CMakeLists.txt b/src/Integrator/CMakeLists.txt index 10a134520..dfd3af71b 100644 --- a/src/Integrator/CMakeLists.txt +++ b/src/Integrator/CMakeLists.txt @@ -1,8 +1,13 @@ +include_directories(.) set(Integrator_inst - CheapSynchronousRK2 Integrator - ) - + PredictorCorrector + SynchronousRK1 + SynchronousRK2 + SynchronousRK4 + CheapSynchronousRK2 + Verlet + ) set(Integrator_sources ) @@ -14,11 +19,7 @@ set(Integrator_headers IntegratorInline.hh ) -blt_add_library(NAME Spheral_Integrator - SOURCES ${Integrator_sources} - HEADERS ${Integrator_headers} - DEPENDS_ON ${spheral_depends} - ) +spheral_add_cxx_library(Integrator) install(TARGETS Spheral_Integrator EXPORT ${PROJECT_NAME}-targets @@ -29,3 +30,6 @@ install(TARGETS Spheral_Integrator install(FILES ${Integrator_headers} DESTINATION include/Integrator ) + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_Integrator) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/Kernel/CMakeLists.txt b/src/Kernel/CMakeLists.txt index ac688a484..1be1a98dd 100644 --- a/src/Kernel/CMakeLists.txt +++ b/src/Kernel/CMakeLists.txt @@ -1,10 +1,23 @@ +include_directories(.) set(Kernel_inst + BSplineKernel + W4SplineKernel GaussianKernel - NBSplineKernel + SuperGaussianKernel PiGaussianKernel - TableKernelAle - VolumeIntegrationFunctionsAle - ) + HatKernel + SincKernel + NSincPolynomialKernel + NBSplineKernel + QuarticSplineKernel + QuinticSplineKernel + TableKernel + VolumeIntegrationFunctions + WendlandC2Kernel + WendlandC4Kernel + WendlandC6Kernel + ExpInvKernel + ) set(Kernel_sources ) @@ -26,11 +39,7 @@ set(Kernel_headers VolumeIntegrationFunctions.hh ) -blt_add_library(NAME Spheral_Kernel - SOURCES ${Kernel_sources} - HEADERS ${Kernel_headers} - DEPENDS_ON ${spheral_depends} - ) +spheral_add_cxx_library(Kernel) install(TARGETS Spheral_Kernel EXPORT ${PROJECT_NAME}-targets @@ -41,3 +50,6 @@ install(TARGETS Spheral_Kernel install(FILES ${Kernel_headers} DESTINATION include/Kernel ) + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_Kernel) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/MHD/CMakeLists.txt b/src/MHD/CMakeLists.txt new file mode 100644 index 000000000..f34b0f12a --- /dev/null +++ b/src/MHD/CMakeLists.txt @@ -0,0 +1,50 @@ +set(MHD_inst + ) + +set(MHD_sources + MHDFieldNames.cc + #ConductingFluidNodeList.cc + CurrentDensityUpdatePolicy.cc + SpitzerResistivityUpdatePolicy.cc + MagnetosonicSpeedUpdatePolicy.cc + #PriceMonaghanDissipation.cc + MHD.cc + ) +instantiate(MHD_inst MHD_sources) + +set(MHD_headers + #ConductingFluidNodeList.hh + CurrentDensityUpdatePolicy.hh + MagnetosonicSpeedUpdatePolicy.hh + MHD.hh + MHDFieldNames.hh + #PriceMonaghanDissipation.hh + SpitzerResistivityUpdatePolicy.hh + ) + +set(MHD_includes + ${SPHERAL_SOURCE_DIR} + ${SPHERAL_SOURCE_DIR}/MHD + ${EIGEN_LIB_LOCATION} + ) + + +blt_add_library(NAME Spheral_MHD + HEADERS ${MHD_headers} + SOURCES ${MHD_sources} + DEPENDS_ON ${spheral_depends} + INCLUDES ${MHD_includes} + ) + +install(TARGETS Spheral_MHD + EXPORT ${PROJECT_NAME}-targets + DESTINATION lib + INCLUDES DESTINATION include + ) + +install(FILES ${MHD_headers} + DESTINATION include/MHD + ) + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_MHD) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/Material/CMakeLists.txt b/src/Material/CMakeLists.txt index c88eec6e1..2950da5fb 100644 --- a/src/Material/CMakeLists.txt +++ b/src/Material/CMakeLists.txt @@ -1,5 +1,9 @@ +include_directories(.) set(Material_inst EquationOfState + GammaLawGas + PolytropicEquationOfState + IsothermalEquationOfState ) @@ -16,11 +20,12 @@ set(Material_headers PhysicalConstantsInline.hh ) -blt_add_library(NAME Spheral_Material - SOURCES ${Material_sources} - HEADERS ${Material_headers} - DEPENDS_ON ${spheral_depends} - ) +set(Material_python_targets + MaterialUnits.py + MaterialEquationsOfState.py + ) + +spheral_add_cxx_library(Material) install(TARGETS Spheral_Material EXPORT ${PROJECT_NAME}-targets @@ -31,3 +36,12 @@ install(TARGETS Spheral_Material install(FILES ${Material_headers} DESTINATION include/Material ) + +if(NOT ENABLE_CXXONLY) + install(FILES ${Material_python_targets} + DESTINATION . + ) +endif() + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_Material) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/Mesh/CMakeLists.txt b/src/Mesh/CMakeLists.txt index 169f8cbef..a87981709 100644 --- a/src/Mesh/CMakeLists.txt +++ b/src/Mesh/CMakeLists.txt @@ -1,8 +1,10 @@ +include_directories(.) set(Mesh_inst MeshPolicy computeGenerators findMatchingVertex generateMesh + copy2polytope ) @@ -46,11 +48,11 @@ set(Mesh_headers generateMesh.hh ) -blt_add_library(NAME Spheral_Mesh - SOURCES ${Mesh_sources} - HEADERS ${Mesh_headers} - DEPENDS_ON ${spheral_depends} - ) +set(Mesh_python_targets + generateMesh.py + siloMeshDump.py) + +spheral_add_cxx_library(Mesh) install(TARGETS Spheral_Mesh EXPORT ${PROJECT_NAME}-targets @@ -61,3 +63,12 @@ install(TARGETS Spheral_Mesh install(FILES ${Mesh_headers} DESTINATION include/Mesh ) + +if(NOT ENABLE_CXXONLY) + install(FILES ${Mesh_python_targets} + DESTINATION . + ) +endif() + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_Mesh) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/Mesh/siloMeshDump.cc b/src/Mesh/siloMeshDump.cc index 6b2c7206a..47a5ba7ca 100644 --- a/src/Mesh/siloMeshDump.cc +++ b/src/Mesh/siloMeshDump.cc @@ -8,7 +8,7 @@ //----------------------------------------------------------------------------// #include #include -#include "boost/share_ptr.hpp" +#include "boost/shared_ptr.hpp" #ifdef USE_MPI #include "mpi.h" diff --git a/src/Neighbor/CMakeLists.txt b/src/Neighbor/CMakeLists.txt index 832b7a44b..434cdc4a4 100644 --- a/src/Neighbor/CMakeLists.txt +++ b/src/Neighbor/CMakeLists.txt @@ -1,3 +1,4 @@ +include_directories(.) set(Neighbor_inst ConnectivityMap GridCellIndex @@ -8,9 +9,8 @@ set(Neighbor_inst ) -set(Neighbor_sources - NodePairList.cc - ) +set(Neighbor_sources + NodePairList.cc) instantiate(Neighbor_inst Neighbor_sources) @@ -26,15 +26,11 @@ set(Neighbor_headers NeighborInline.hh NestedGridNeighbor.hh NestedGridNeighborInline.hh - NodePairList.hh TreeNeighbor.hh + NodePairList.hh ) -blt_add_library(NAME Spheral_Neighbor - SOURCES ${Neighbor_sources} - HEADERS ${Neighbor_headers} - DEPENDS_ON ${spheral_depends} - ) +spheral_add_cxx_library(Neighbor) install(TARGETS Spheral_Neighbor EXPORT ${PROJECT_NAME}-targets @@ -45,3 +41,6 @@ install(TARGETS Spheral_Neighbor install(FILES ${Neighbor_headers} DESTINATION include/Neighbor ) + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_Neighbor) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/NodeGenerators/CMakeLists.txt b/src/NodeGenerators/CMakeLists.txt index 5e15043e8..19e562f04 100644 --- a/src/NodeGenerators/CMakeLists.txt +++ b/src/NodeGenerators/CMakeLists.txt @@ -1,10 +1,16 @@ +include_directories(.) set(NodeGenerators_inst + relaxNodeDistribution + centroidalRelaxNodesImpl + compactFacetedVolumes + chooseRandomNonoverlappingCenter ) set(NodeGenerators_sources - fillFacetedVolume.cc generateCylDistributionFromRZ.cc - ) + fillFacetedVolume.cc + readSiloPolyMesh.cc + ) instantiate(NodeGenerators_inst NodeGenerators_sources) @@ -13,11 +19,44 @@ set(NodeGenerators_headers generateCylDistributionFromRZ.hh ) -blt_add_library(NAME Spheral_NodeGenerators - SOURCES ${NodeGenerators_sources} - HEADERS ${NodeGenerators_headers} - DEPENDS_ON ${spheral_depends} - ) +set(NodeGenerators_python_targets + NodeGeneratorBase.py + GenerateNodeDistribution2d.py + GenerateNodeDistribution3d.py + CompositeNodeDistribution.py + distributeNodesGeneric.py + DistributeNodes.py + ParMETISDistributeNodes.py + MortonOrderDistributeNodes.py + PeanoHilbertDistributeNodes.py + VoronoiDistributeNodes.py + NestedGridDistributeNodes.py + GzipFileNodeGenerator.py + DumpGzipFileNodeGenerator.py + CubicNodeGenerator.py + GenerateSphericalShellSection.py + AbaqusNodeGenerator.py + CentroidalVoronoiRelaxation.py + InteriorGenerator.py + FacetedSurfaceGenerator.py + AsciiFileNodeGenerator.py + HydroStaticProfile.py + StretchedLattice2d.py + StretchedLattice3d.py + GenerateEqualMassSheets3d.py + SiloPolyMeshGenerator.py + GenerateRatioSlab.py + GenerateRatioSphere.py + GenerateNodeProfile.py + CentroidalGenerator2d.py + centroidalRelaxNodes.py + MedialGenerator.py + MultiScaleMedialGenerator.py + RecursivePrimitiveRefinementGenerator.py + SEAGenerator.py + ) + +spheral_add_cxx_library(NodeGenerators) install(TARGETS Spheral_NodeGenerators EXPORT ${PROJECT_NAME}-targets @@ -28,3 +67,11 @@ install(TARGETS Spheral_NodeGenerators install(FILES ${NodeGenerators_headers} DESTINATION include/NodeGenerators ) + +if(NOT ENABLE_CXXONLY) + install(FILES ${NodeGenerators_python_targets} + DESTINATION . + ) +endif() +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_NodeGenerators) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/NodeList/CMakeLists.txt b/src/NodeList/CMakeLists.txt index b9f94ba4f..5892b9a71 100644 --- a/src/NodeList/CMakeLists.txt +++ b/src/NodeList/CMakeLists.txt @@ -1,3 +1,4 @@ +include_directories(.) set(NodeList_inst ASPHSmoothingScale FluidNodeList @@ -7,6 +8,8 @@ set(NodeList_inst SmoothingScaleBase SolidNodeList generateVoidNodes + FixedSmoothingScale + nthNodalMoment ) set(NodeList_sources ) @@ -30,11 +33,13 @@ set(NodeList_headers secondMomentUtilities.hh ) -blt_add_library(NAME Spheral_NodeList - SOURCES ${NodeList_sources} - HEADERS ${NodeList_headers} - DEPENDS_ON ${spheral_depends} - ) +set(NodeList_python_targets + FluidNodeLists.py + SolidNodeLists.py + VoidNodeLists.py + ) + +spheral_add_cxx_library(NodeList) install(TARGETS Spheral_NodeList EXPORT ${PROJECT_NAME}-targets @@ -45,3 +50,12 @@ install(TARGETS Spheral_NodeList install(FILES ${NodeList_headers} DESTINATION include/NodeList ) + +if(NOT ENABLE_CXXONLY) + install(FILES ${NodeList_python_targets} + DESTINATION . + ) +endif() + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_NodeList) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/PBGWraps/CMakeLists.txt b/src/PBGWraps/CMakeLists.txt new file mode 100644 index 000000000..8e0983072 --- /dev/null +++ b/src/PBGWraps/CMakeLists.txt @@ -0,0 +1,8 @@ +set(PBGWraps_python_targets + SpheralPickle.py + PolyhedronFileUtilities.py + ) + +install(FILES ${PBGWraps_python_targets} + DESTINATION . + ) diff --git a/src/Physics/CMakeLists.txt b/src/Physics/CMakeLists.txt index b1c20442b..33b1e171c 100644 --- a/src/Physics/CMakeLists.txt +++ b/src/Physics/CMakeLists.txt @@ -1,3 +1,4 @@ +include_directories(.) set(Physics_inst GenericBodyForce GenericHydro @@ -16,11 +17,7 @@ set(Physics_headers PhysicsInline.hh ) -blt_add_library(NAME Spheral_Physics - SOURCES ${Physics_sources} - HEADERS ${Physics_headers} - DEPENDS_ON ${spheral_depends} - ) +spheral_add_cxx_library(Physics) install(TARGETS Spheral_Physics EXPORT ${PROJECT_NAME}-targets @@ -31,3 +28,6 @@ install(TARGETS Spheral_Physics install(FILES ${Physics_headers} DESTINATION include/Physics ) + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_Physics) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/Pybind11Wraps/ArtificialConduction/CMakeLists.txt b/src/Pybind11Wraps/ArtificialConduction/CMakeLists.txt new file mode 100644 index 000000000..a6cc99756 --- /dev/null +++ b/src/Pybind11Wraps/ArtificialConduction/CMakeLists.txt @@ -0,0 +1,31 @@ +set(PYB11_MODULE_NAME ArtificialConduction) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ${PYBIND11_INCLUDE_DIRS} + ${EIGEN_INCLUDE_DIRS} + ${BLT_MPI_INCLUDES} + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/ArtificialViscosity/CMakeLists.txt b/src/Pybind11Wraps/ArtificialViscosity/CMakeLists.txt new file mode 100644 index 000000000..ba9842717 --- /dev/null +++ b/src/Pybind11Wraps/ArtificialViscosity/CMakeLists.txt @@ -0,0 +1,31 @@ +set(PYB11_MODULE_NAME ArtificialViscosity) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ${PYBIND11_INCLUDE_DIRS} + ${EIGEN_INCLUDE_DIRS} + ${BLT_MPI_INCLUDES} + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ${POLYTOPE_LIBRARY}) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/Boundary/CMakeLists.txt b/src/Pybind11Wraps/Boundary/CMakeLists.txt new file mode 100644 index 000000000..40133cfe1 --- /dev/null +++ b/src/Pybind11Wraps/Boundary/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME Boundary) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/CMakeLists.txt b/src/Pybind11Wraps/CMakeLists.txt new file mode 100644 index 000000000..e863285c2 --- /dev/null +++ b/src/Pybind11Wraps/CMakeLists.txt @@ -0,0 +1,65 @@ +set (_python_packages + CXXTypes + Geometry + PolyClipper + Silo + DataOutput + NodeList + Field + FieldList + Kernel + Neighbor + Material + FileIO + Utilities + RK + DataBase + Boundary + Physics + Hydro + ExternalForce + Gravity + Integrator + NodeGenerators + FieldOperations + SPH + CRKSPH + SVPH + ArtificialViscosity + Mesh + Damage + SolidMaterial + Strength + ArtificialConduction + polytope + Distributed + OpenMP + ) + +if(NOT ENABLE_MPI) + list(REMOVE_ITEM _python_packages + Distributed + ) +endif() + +foreach(_python_package ${_python_packages}) + add_subdirectory(${_python_package}) +endforeach() + +string(REPLACE ";" " " PYTHONPKGS "${_python_packages}") +configure_file( + SpheralCompiledPackages.py.in + ${CMAKE_INSTALL_PREFIX}/SpheralCompiledPackages.py) + +set(Pybind11Wraps_python_targets + SpheralPickle.py + PolyhedronFileUtilities.py + ) + +install(FILES ${Pybind11Wraps_python_targets} + DESTINATION . + ) + +install(FILES Spheral.pth + DESTINATION .. + ) diff --git a/src/Pybind11Wraps/CRKSPH/CMakeLists.txt b/src/Pybind11Wraps/CRKSPH/CMakeLists.txt new file mode 100644 index 000000000..490397870 --- /dev/null +++ b/src/Pybind11Wraps/CRKSPH/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME CRKSPH) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/CXXTypes/CMakeLists.txt b/src/Pybind11Wraps/CXXTypes/CMakeLists.txt new file mode 100644 index 000000000..20d1799ef --- /dev/null +++ b/src/Pybind11Wraps/CXXTypes/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME CXXTypes) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/Damage/CMakeLists.txt b/src/Pybind11Wraps/Damage/CMakeLists.txt new file mode 100644 index 000000000..6e4ecd7d7 --- /dev/null +++ b/src/Pybind11Wraps/Damage/CMakeLists.txt @@ -0,0 +1,32 @@ +set(PYB11_MODULE_NAME Damage) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ${PYBIND11_INCLUDE_DIRS} + ${EIGEN_INCLUDE_DIRS} + ${POLYTOPE_INCLUDE_DIRS} + ${BLT_MPI_INCLUDES} + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/DataBase/CMakeLists.txt b/src/Pybind11Wraps/DataBase/CMakeLists.txt new file mode 100644 index 000000000..ff96a62d1 --- /dev/null +++ b/src/Pybind11Wraps/DataBase/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME DataBase) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/DataOutput/CMakeLists.txt b/src/Pybind11Wraps/DataOutput/CMakeLists.txt new file mode 100644 index 000000000..1f25e0c91 --- /dev/null +++ b/src/Pybind11Wraps/DataOutput/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME DataOutput) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/Pybind11Wraps/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR} + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES RestartableObject.cc) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/Distributed/CMakeLists.txt b/src/Pybind11Wraps/Distributed/CMakeLists.txt new file mode 100644 index 000000000..2f2a03d0f --- /dev/null +++ b/src/Pybind11Wraps/Distributed/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME Distributed) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/ExternalForce/CMakeLists.txt b/src/Pybind11Wraps/ExternalForce/CMakeLists.txt new file mode 100644 index 000000000..c849a68b8 --- /dev/null +++ b/src/Pybind11Wraps/ExternalForce/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME ExternalForce) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/Field/CMakeLists.txt b/src/Pybind11Wraps/Field/CMakeLists.txt new file mode 100644 index 000000000..14f6011e1 --- /dev/null +++ b/src/Pybind11Wraps/Field/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME Field) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/FieldList/CMakeLists.txt b/src/Pybind11Wraps/FieldList/CMakeLists.txt new file mode 100644 index 000000000..f94d71ff1 --- /dev/null +++ b/src/Pybind11Wraps/FieldList/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME FieldList) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/FieldOperations/CMakeLists.txt b/src/Pybind11Wraps/FieldOperations/CMakeLists.txt new file mode 100644 index 000000000..e7cf62db0 --- /dev/null +++ b/src/Pybind11Wraps/FieldOperations/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME FieldOperations) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/FileIO/CMakeLists.txt b/src/Pybind11Wraps/FileIO/CMakeLists.txt new file mode 100644 index 000000000..a66b51320 --- /dev/null +++ b/src/Pybind11Wraps/FileIO/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME FileIO) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/Geometry/CMakeLists.txt b/src/Pybind11Wraps/Geometry/CMakeLists.txt new file mode 100644 index 000000000..db791703d --- /dev/null +++ b/src/Pybind11Wraps/Geometry/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME Geometry) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/Gravity/CMakeLists.txt b/src/Pybind11Wraps/Gravity/CMakeLists.txt new file mode 100644 index 000000000..178585a01 --- /dev/null +++ b/src/Pybind11Wraps/Gravity/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME Gravity) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/Hydro/CMakeLists.txt b/src/Pybind11Wraps/Hydro/CMakeLists.txt new file mode 100644 index 000000000..933d00b64 --- /dev/null +++ b/src/Pybind11Wraps/Hydro/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME Hydro) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/Integrator/CMakeLists.txt b/src/Pybind11Wraps/Integrator/CMakeLists.txt new file mode 100644 index 000000000..9160a7843 --- /dev/null +++ b/src/Pybind11Wraps/Integrator/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME Integrator) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/Kernel/CMakeLists.txt b/src/Pybind11Wraps/Kernel/CMakeLists.txt new file mode 100644 index 000000000..4f2f4caef --- /dev/null +++ b/src/Pybind11Wraps/Kernel/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME Kernel) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/Material/CMakeLists.txt b/src/Pybind11Wraps/Material/CMakeLists.txt new file mode 100644 index 000000000..5017d844c --- /dev/null +++ b/src/Pybind11Wraps/Material/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME Material) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/Mesh/CMakeLists.txt b/src/Pybind11Wraps/Mesh/CMakeLists.txt new file mode 100644 index 000000000..4a6e46371 --- /dev/null +++ b/src/Pybind11Wraps/Mesh/CMakeLists.txt @@ -0,0 +1,32 @@ +set(PYB11_MODULE_NAME Mesh) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ${PYBIND11_INCLUDE_DIRS} + ${EIGEN_INCLUDE_DIRS} + ${POLYTOPE_INCLUDE_DIRS} + ${BLT_MPI_INCLUDES} + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/Neighbor/CMakeLists.txt b/src/Pybind11Wraps/Neighbor/CMakeLists.txt new file mode 100644 index 000000000..155ca8c84 --- /dev/null +++ b/src/Pybind11Wraps/Neighbor/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME Neighbor) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/NodeGenerators/CMakeLists.txt b/src/Pybind11Wraps/NodeGenerators/CMakeLists.txt new file mode 100644 index 000000000..bdfb8f281 --- /dev/null +++ b/src/Pybind11Wraps/NodeGenerators/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME NodeGenerators) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/NodeList/CMakeLists.txt b/src/Pybind11Wraps/NodeList/CMakeLists.txt new file mode 100644 index 000000000..71edda101 --- /dev/null +++ b/src/Pybind11Wraps/NodeList/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME NodeList) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/OpenMP/CMakeLists.txt b/src/Pybind11Wraps/OpenMP/CMakeLists.txt new file mode 100644 index 000000000..ad437fea0 --- /dev/null +++ b/src/Pybind11Wraps/OpenMP/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME OpenMP) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/OpenMP/OpenMPMOD.py b/src/Pybind11Wraps/OpenMP/OpenMPMOD.py index 38c12acff..f25e90867 100644 --- a/src/Pybind11Wraps/OpenMP/OpenMPMOD.py +++ b/src/Pybind11Wraps/OpenMP/OpenMPMOD.py @@ -9,20 +9,20 @@ PYB11includes = ['"Utilities/OpenMP_wrapper.hh"'] PYB11preamble = """ -#ifdef _OPENMP //------------------------------------------------------------------------------ // In order to report the number of threads, we have to check in an OpenMP // section. //------------------------------------------------------------------------------ inline int wrap_omp_get_num_threads() { - int result; + int result = 1; +#ifdef _OPENMP #pragma omp parallel { if (omp_get_thread_num() == 0) result = omp_get_num_threads(); } +#endif return result; } -#endif """ @PYB11cppname("wrap_omp_get_num_threads") diff --git a/src/Pybind11Wraps/Physics/CMakeLists.txt b/src/Pybind11Wraps/Physics/CMakeLists.txt new file mode 100644 index 000000000..ac73d0bf7 --- /dev/null +++ b/src/Pybind11Wraps/Physics/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME Physics) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/PolyClipper/CMakeLists.txt b/src/Pybind11Wraps/PolyClipper/CMakeLists.txt new file mode 100644 index 000000000..2680b2f02 --- /dev/null +++ b/src/Pybind11Wraps/PolyClipper/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME PolyClipper) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/RK/CMakeLists.txt b/src/Pybind11Wraps/RK/CMakeLists.txt new file mode 100644 index 000000000..26734ccc7 --- /dev/null +++ b/src/Pybind11Wraps/RK/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME RK) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/SPH/CMakeLists.txt b/src/Pybind11Wraps/SPH/CMakeLists.txt new file mode 100644 index 000000000..fe3fcde5c --- /dev/null +++ b/src/Pybind11Wraps/SPH/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME SPH) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/SVPH/CMakeLists.txt b/src/Pybind11Wraps/SVPH/CMakeLists.txt new file mode 100644 index 000000000..ec9823db0 --- /dev/null +++ b/src/Pybind11Wraps/SVPH/CMakeLists.txt @@ -0,0 +1,32 @@ +set(PYB11_MODULE_NAME SVPH) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ${PYBIND11_INCLUDE_DIRS} + ${EIGEN_INCLUDE_DIRS} + ${POLYTOPE_INCLUDE_DIRS} + ${BLT_MPI_INCLUDES} + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/Silo/CMakeLists.txt b/src/Pybind11Wraps/Silo/CMakeLists.txt new file mode 100644 index 000000000..2bb1abe37 --- /dev/null +++ b/src/Pybind11Wraps/Silo/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME Silo) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/Pybind11Wraps/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR} + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/SolidMaterial/CMakeLists.txt b/src/Pybind11Wraps/SolidMaterial/CMakeLists.txt new file mode 100644 index 000000000..0378ef22c --- /dev/null +++ b/src/Pybind11Wraps/SolidMaterial/CMakeLists.txt @@ -0,0 +1,32 @@ +set(PYB11_MODULE_NAME SolidMaterial) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ${PYBIND11_INCLUDE_DIRS} + ${EIGEN_INCLUDE_DIRS} + ${POLYTOPE_INCLUDE_DIRS} + ${BLT_MPI_INCLUDES} + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/Strength/CMakeLists.txt b/src/Pybind11Wraps/Strength/CMakeLists.txt new file mode 100644 index 000000000..2d8cd0342 --- /dev/null +++ b/src/Pybind11Wraps/Strength/CMakeLists.txt @@ -0,0 +1,32 @@ +set(PYB11_MODULE_NAME Strength) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ${PYBIND11_INCLUDE_DIRS} + ${EIGEN_INCLUDE_DIRS} + ${POLYTOPE_INCLUDE_DIRS} + ${BLT_MPI_INCLUDES} + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ${QHULL_LIBRARY}) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/Utilities/CMakeLists.txt b/src/Pybind11Wraps/Utilities/CMakeLists.txt new file mode 100644 index 000000000..1ed753aaf --- /dev/null +++ b/src/Pybind11Wraps/Utilities/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME Utilities) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/Pybind11Wraps/polytope/CMakeLists.txt b/src/Pybind11Wraps/polytope/CMakeLists.txt new file mode 100644 index 000000000..628567152 --- /dev/null +++ b/src/Pybind11Wraps/polytope/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PYB11_MODULE_NAME polytope) +include(UsePYB11Generator) +PYB11_GENERATE_BINDINGS() + +set(MODULE_INCLUDES + ${PROJECT_SOURCE_DIR}/src/${PYB11_MODULE_NAME} + ${PROJECT_SOURCE_DIR}/src + ) + +set(MODULE_NAME Spheral${PYB11_MODULE_NAME}) +set(GENERATED_SOURCE Spheral${PYB11_GENERATED_SOURCE}) +set(ADDITIONAL_SOURCES ) +set(ADDITIONAL_DEPENDS ) + +blt_add_library( + NAME ${MODULE_NAME} + SOURCES ${GENERATED_SOURCE} ${ADDITIONAL_SOURCES} + DEPENDS_ON ${SPHERAL_PYTHON_DEPENDS} ${ADDITIONAL_DEPENDS} ${spheral_depends} + INCLUDES ${MODULE_INCLUDES} + OUTPUT_NAME ${MODULE_NAME} + CLEAR_PREFIX TRUE + SHARED TRUE + ) + +install( + FILES ${CMAKE_BINARY_DIR}/lib/$ + DESTINATION . + ) diff --git a/src/PythonMPIInterfaces/CMakeLists.txt b/src/PythonMPIInterfaces/CMakeLists.txt new file mode 100644 index 000000000..39e8dfdb2 --- /dev/null +++ b/src/PythonMPIInterfaces/CMakeLists.txt @@ -0,0 +1,14 @@ +if (ENABLE_MPI) + set(PythonMPIInterfaces_python_targets + mpi_mpi4py.py + ) +else() + set(PythonMPIInterfaces_python_targets + fakempi.py + ) +endif() + +install(FILES ${PythonMPIInterfaces_python_targets} + DESTINATION . + RENAME mpi.py + ) diff --git a/src/RK/CMakeLists.txt b/src/RK/CMakeLists.txt new file mode 100644 index 000000000..e68524156 --- /dev/null +++ b/src/RK/CMakeLists.txt @@ -0,0 +1,64 @@ +include_directories(.) +set(RK_inst + computeRKSumVolume + computeOccupancyVolume + computeHullVolumes + computeHVolumes + HVolumePolicy + ContinuityVolumePolicy + computeRKVolumes + RKCorrections + RKUtilities + ReproducingKernelMethods + ReproducingKernel + interpolateRK + gradientRK + hessianRK + ) + +set(RK_sources + computeVoronoiVolume.cc + computeVoronoiVolume1d.cc + RKFieldNames.cc + ) + +if(ENABLE_2D) + list(APPEND RK_sources + ContinuityVolumePolicyRZ.cc + ) +endif() + +instantiate(RK_inst RK_sources) + +set(RK_headers + computeHullVolumes.hh + computeHVolumes.hh + computeOccupancyVolume.hh + computeRKSumVolume.hh + computeRKVolumes.hh + computeVoronoiVolume.hh + ContinuityVolumePolicy.hh + ContinuityVolumePolicyRZ.hh + HullVolumePolicy.hh + HVolumePolicy.hh + interpolateRK.hh + RKCorrectionParams.hh + RKCorrections.hh + RKUtilities.hh + RKUtilitiesInline.hh + ) + +spheral_add_cxx_library(RK) + +install(TARGETS Spheral_RK + EXPORT ${PROJECT_NAME}-targets + DESTINATION lib + INCLUDES DESTINATION include + ) + +install(FILES ${RK_headers} + DESTINATION include/RK + ) + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_RK) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/SPH/CMakeLists.txt b/src/SPH/CMakeLists.txt index a1301aa2e..5d2482544 100644 --- a/src/SPH/CMakeLists.txt +++ b/src/SPH/CMakeLists.txt @@ -1,10 +1,13 @@ +include_directories(.) set(SPH_inst SPHHydroBase + PSPHHydroBase SolidSPHHydroBase computeSPHOmegaGradhCorrection computeSPHSumMassDensity - computeSumVoronoiCellMassDensity correctSPHSumMassDensity + computePSPHCorrections + computeSumVoronoiCellMassDensity ) @@ -18,12 +21,15 @@ if(ENABLE_2D) ) endif() +if(ENABLE_3D) + list(APPEND SPH_sources + computeHydrostaticEquilibriumPressure.cc + ) +endif() + instantiate(SPH_inst SPH_sources) set(SPH_headers - DamagedNodeCoupling.hh - DamagedNodeCouplingWithFrags.hh - NodeCoupling.hh OmegaGradhPolicy.hh SPHHydroBase.hh SPHHydroBaseGSRZ.hh @@ -32,6 +38,7 @@ set(SPH_headers SolidSPHHydroBase.hh SolidSPHHydroBaseInline.hh SolidSPHHydroBaseRZ.hh + #SolidSPHHydroBaseRZInline.hh computeHydrostaticEquilibriumPressure.hh computeSPHOmegaGradhCorrection.hh computeSPHSumMassDensity.hh @@ -39,11 +46,14 @@ set(SPH_headers correctSPHSumMassDensity.hh ) -blt_add_library(NAME Spheral_SPH - SOURCES ${SPH_sources} - HEADERS ${SPH_headers} - DEPENDS_ON ${spheral_depends} - ) +set(SPH_python_targets + SPHHydros.py + PSPHHydros.py + SPHUtilities.py + FacetedSurfaceASPHHydro.py + ) + +spheral_add_cxx_library(SPH) install(TARGETS Spheral_SPH EXPORT ${PROJECT_NAME}-targets @@ -54,3 +64,12 @@ install(TARGETS Spheral_SPH install(FILES ${SPH_headers} DESTINATION include/SPH ) + +if(NOT ENABLE_CXXONLY) + install(FILES ${SPH_python_targets} + DESTINATION . + ) +endif() + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_SPH) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/SVPH/CMakeLists.txt b/src/SVPH/CMakeLists.txt new file mode 100644 index 000000000..010c8166b --- /dev/null +++ b/src/SVPH/CMakeLists.txt @@ -0,0 +1,65 @@ +include_directories(.) +set(SVPH_inst + computeSVPHCorrections + computeSVPHCorrectionsOnFaces + computeSumVoronoiCellMassDensityFromFaces + sampleFieldListSVPH + gradientFieldListSVPH + SVPHFacetedHydroBase + SVPHCorrectionsPolicy + SVPHMassDensityPolicy + CompatibleFaceSpecificThermalEnergyPolicy + MeshIdealHPolicy + SpecificThermalEnergyVolumePolicy + CellPressurePolicy + ) + + +set(SVPH_sources + SVPHFieldNames.cc + ) + +instantiate(SVPH_inst SVPH_sources) + +set(SVPH_headers + CellPressurePolicy.hh + CompatibleFaceSpecificThermalEnergyPolicy.hh + computeSumVoronoiCellMassDensityFromFaces.hh + computeSVPHCorrections.hh + computeSVPHCorrectionsOnFaces.hh + gradientFieldListSVPH.hh + MeshIdealHPolicy.hh + sampleFieldListSVPH.hh + SpecificThermalEnergyVolumePolicy.hh + SVPHCorrectionsPolicy.hh + SVPHFacetedHydroBase.hh + SVPHFacetedHydroBaseInline.hh + SVPHHydroBase.hh + SVPHHydroBaseInline.hh + SVPHMassDensityPolicy.hh + ) + +set(SVPH_python_targets + SVPHHydros.py + ) + +spheral_add_cxx_library(SVPH) + +install(TARGETS Spheral_SVPH + EXPORT ${PROJECT_NAME}-targets + DESTINATION lib + INCLUDES DESTINATION include + ) + +install(FILES ${SVPH_headers} + DESTINATION include/SVPH + ) + +if(NOT ENABLE_CXXONLY) + install(FILES ${SVPH_python_targets} + DESTINATION . + ) +endif() + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_SVPH) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/SimulationControl/CMakeLists.txt b/src/SimulationControl/CMakeLists.txt new file mode 100644 index 000000000..90b01efbd --- /dev/null +++ b/src/SimulationControl/CMakeLists.txt @@ -0,0 +1,80 @@ +execute_process( + COMMAND git --git-dir ${CMAKE_SOURCE_DIR}/../.git rev-parse --abbrev-ref HEAD + OUTPUT_VARIABLE abbref + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + +execute_process( + COMMAND git --git-dir ${CMAKE_SOURCE_DIR}/../.git rev-parse --short HEAD + OUTPUT_VARIABLE short + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + +execute_process( + COMMAND git --git-dir ${CMAKE_SOURCE_DIR}/../.git log --oneline + COMMAND wc -l + OUTPUT_VARIABLE oneline + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + +set(SPHERAL_VERSION_LIST ${abbref} ${short} ${oneline}) +string(REPLACE ";" " " spheralversion "${SPHERAL_VERSION_LIST}") +configure_file( + Spheral.py + ${CMAKE_INSTALL_PREFIX}/Spheral.py) + +set(_dims 1) +if(ENABLE_2D) + list(APPEND _dims 2) +endif() +if(ENABLE_3D) + list(APPEND _dims 3) +endif() + +string(REPLACE ";" " " DIMS "${_dims}") +configure_file( + spheralDimensions.py.in + ${CMAKE_SOURCE_DIR}/SimulationControl/spheralDimensions.py) + + +set(SimulationControl_python_targets + Spheral1d.py + Spheral2d.py + Spheral3d.py + SpheralRZ.py + SolidSpheral1d.py + SolidSpheral2d.py + SolidSpheral3d.py + SolidSpheralRZ.py + SpheralTestUtilities.py + SpheralTimer.py + SpheralConservation.py + SpheralController.py + SpheralOptionParser.py + SpheralVisitDump.py + SpheralVoronoiSiloDump.py + SpheralPolytopeSiloDump.py + Spheral1dVizDump.py + SpheralGnuPlotUtilities.py + SpheralMatplotlib.py + findLastRestart.py + Pnorm.py + filearraycmp.py + numericalIntegration.py + newtonRaphson.py + bisectFunction.py + NodeHistory.py + AverageStrain.py + EulerianTracerHistory.py + SpheralHadesDump.py + siloPointmeshDump.py + SpheralPointmeshSiloDump.py + resampleNodeList.py + overlayNodeList.py + writeSiloQuadMesh.py + spheralDimensions.py + ) + +install(FILES ${SimulationControl_python_targets} + DESTINATION . + ) diff --git a/src/SimulationControl/spheralDimensions.py b/src/SimulationControl/spheralDimensions.py new file mode 100644 index 000000000..3868427dc --- /dev/null +++ b/src/SimulationControl/spheralDimensions.py @@ -0,0 +1,26 @@ +# -*- mode: python -*- +#------------------------------------------------------------------------------- +# Provide a method of getting the instantiated dimensions from python. +#------------------------------------------------------------------------------- +def spheralDimensions(): + spheralDimensions.PYB11ignore = True # Screen from PYB11 + dims_string = "1 2 3" + dims = [int(x) for x in dims_string.split()] + return dims + +#------------------------------------------------------------------------------- +# Return a dictionary of useful Spheral Dimensional types. +#------------------------------------------------------------------------------- +def dimDictionary(ndim): + dimDictionary.PYB11ignore = True # Screen from PYB11 + return {"Dimension" : "Dim<%i>" % ndim, + "Scalar" : "Dim<%i>::Scalar" % ndim, + "Vector" : "Dim<%i>::Scalar" % ndim, + "Tensor" : "Dim<%i>::Scalar" % ndim, + "SymTensor" : "Dim<%i>::Scalar" % ndim, + "ScalarField" : "Field, Dim<%i>::Scalar>" % (ndim, ndim), + "VectorField" : "Field, Dim<%i>::Vector>" % (ndim, ndim), + "TensorField" : "Field, Dim<%i>::Tensor>" % (ndim, ndim), + "SymTensorField" : "Field, Dim<%i>::SymTensor>" % (ndim, ndim), + } +dimDictionary.PYB11ignore = True # Screen from PYB11 diff --git a/src/SolidMaterial/CMakeLists.txt b/src/SolidMaterial/CMakeLists.txt index 935b814b7..e02ed42b0 100644 --- a/src/SolidMaterial/CMakeLists.txt +++ b/src/SolidMaterial/CMakeLists.txt @@ -1,6 +1,18 @@ +include_directories(.) set(SolidMaterial_inst LinearPolynomialEquationOfState + GruneisenEquationOfState + OsborneEquationOfState + MurnahanEquationOfState + TillotsonEquationOfState StrengthModel + SteinbergGuinanStrength + JohnsonCookStrength + CollinsStrength + PorousEquationOfState + PorousStrengthModel + StrainPorosity + PhysicsEvolvingMaterialLibrary ) set(SolidMaterial_sources ) @@ -8,19 +20,46 @@ set(SolidMaterial_sources ) instantiate(SolidMaterial_inst SolidMaterial_sources) set(SolidMaterial_headers + ANEOS.hh + CollinsStrength.hh + ConstantStrength.hh + Geodyn.hh + GruneisenEquationOfState.hh + GruneisenEquationOfStateInline.hh + JohnsonCookStrength.hh LinearPolynomialEquationOfState.hh LinearPolynomialEquationOfStateInline.hh + MurnahanEquationOfState.hh + MurnahanEquationOfStateInline.hh NullStrength.hh + OsborneEquationOfState.hh + OsborneEquationOfStateInline.hh + PhysicsEvolvingMaterialLibrary.hh + PolynomialFit.hh + PolynomialFitInline.hh + PorousEquationOfState.hh + PorousStrengthModel.hh SolidEquationOfState.hh SolidEquationOfStateInline.hh + SteinbergGuinanLundStrength.hh + SteinbergGuinanStrength.hh + StrainPorosity.hh + StrainPorosityInline.hh StrengthModel.hh + TillotsonEquationOfState.hh + TillotsonEquationOfStateInline.hh ) -blt_add_library(NAME Spheral_SolidMaterial - SOURCES ${SolidMaterial_sources} - HEADERS ${SolidMaterial_headers} - DEPENDS_ON ${spheral_depends} - ) +set(SolidMaterial_python_targets + MaterialPropertiesLib.py + SolidMaterialUnits.py + SolidMaterialEquationsOfState.py + ShadowTillotsonEquationOfState.py + ShadowConstantStrength.py + ) + + +spheral_add_cxx_library(SolidMaterial) install(TARGETS Spheral_SolidMaterial EXPORT ${PROJECT_NAME}-targets @@ -31,3 +70,12 @@ install(TARGETS Spheral_SolidMaterial install(FILES ${SolidMaterial_headers} DESTINATION include/SolidMaterial ) + +if(NOT ENABLE_CXXONLY) + install(FILES ${SolidMaterial_python_targets} + DESTINATION . + ) +endif() + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_SolidMaterial) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/Strength/CMakeLists.txt b/src/Strength/CMakeLists.txt index 7601664c1..065944f9d 100644 --- a/src/Strength/CMakeLists.txt +++ b/src/Strength/CMakeLists.txt @@ -1,3 +1,4 @@ +include_directories(.) set(Strength_inst BulkModulusPolicy DeviatoricStressPolicy @@ -14,6 +15,7 @@ set(Strength_sources if(ENABLE_2D) list(APPEND Strength_sources + #RZDeviatoricStressPolicy.cc RZPlasticStrainPolicy.cc ) endif() @@ -25,6 +27,7 @@ set(Strength_headers DeviatoricStressPolicy.hh MeltEnergyPolicy.hh PlasticStrainPolicy.hh + #RZDeviatoricStressPolicy.hh RZPlasticStrainPolicy.hh ShearModulusPolicy.hh SolidFieldNames.hh @@ -33,11 +36,7 @@ set(Strength_headers effectiveKernelVolume.hh ) -blt_add_library(NAME Spheral_Strength - SOURCES ${Strength_sources} - HEADERS ${Strength_headers} - DEPENDS_ON ${spheral_depends} - ) +spheral_add_cxx_library(Strength) install(TARGETS Spheral_Strength EXPORT ${PROJECT_NAME}-targets @@ -48,3 +47,6 @@ install(TARGETS Spheral_Strength install(FILES ${Strength_headers} DESTINATION include/Strength ) + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_Strength) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/Utilities/CMakeLists.txt b/src/Utilities/CMakeLists.txt index 74203069c..75f5b1294 100644 --- a/src/Utilities/CMakeLists.txt +++ b/src/Utilities/CMakeLists.txt @@ -1,11 +1,17 @@ +include_directories(.) set(Utilities_inst - boundingBox - computeShepardsInterpolation - globalBoundingVolumes iterateIdealH mortonOrderIndices - nodeBoundingBoxes peanoHilbertOrderIndices + nodeOrdering + nodeBoundingBoxes + boundingBox + globalBoundingVolumes + integrateThroughMeshAlongSegment + numberDensity + medianPosition + computeShepardsInterpolation + overlayRemapFields ) set(Utilities_sources @@ -22,9 +28,11 @@ set(Utilities_sources pointInPolygon.cc pointOnPolyhedron.cc pointInPolyhedron.cc + refinePolyhedron.cc coarsenBinnedValuesInst.cc + clipFacetedVolume.cc SpheralTimers.cc - SpheralTimersAlternate.cc + #SpheralTimersAlternate.cc Timer.cc ) @@ -33,10 +41,12 @@ instantiate(Utilities_inst Utilities_sources) set(Utilities_headers Bessel.hh CounterClockwiseComparator.hh + DamagedNodeCoupling.hh + DamagedNodeCouplingWithFrags.hh DBC.hh - DataTypeTraits.hh DomainNode.hh DomainNodeInline.hh + DataTypeTraits.hh FastMath.hh FieldDataTypeTraits.hh Functors.hh @@ -82,6 +92,7 @@ set(Utilities_headers newtonRaphson.hh nodeBoundingBoxes.hh nodeBoundingBoxesInline.hh + NodeCoupling.hh overlayRemapFields.hh packElement.hh peanoHilbertOrderIndices.hh @@ -98,15 +109,16 @@ set(Utilities_headers segmentIntersectEdges.hh simpsonsIntegration.hh sort_permutation.hh + SurfaceNodeCoupling.hh testBoxIntersection.hh timingUtilities.hh ) -blt_add_library(NAME Spheral_Utilities - SOURCES ${Utilities_sources} - HEADERS ${Utilities_headers} - DEPENDS_ON ${spheral_depends} - ) +set(Utilities_python_targets + fitspline.py + ) + +spheral_add_cxx_library(Utilities) install(TARGETS Spheral_Utilities EXPORT ${PROJECT_NAME}-targets @@ -117,3 +129,12 @@ install(TARGETS Spheral_Utilities install(FILES ${Utilities_headers} DESTINATION include/Utilities ) + +if(NOT ENABLE_CXXONLY) + install(FILES ${Utilities_python_targets} + DESTINATION . + ) +endif() + +list(APPEND SPHERAL_PYTHON_DEPENDS Spheral_Utilities) +set(SPHERAL_PYTHON_DEPENDS "${SPHERAL_PYTHON_DEPENDS}" PARENT_SCOPE) diff --git a/src/thirdPartyLibs/CMakeLists.txt b/src/thirdPartyLibs/CMakeLists.txt new file mode 100644 index 000000000..2855e8891 --- /dev/null +++ b/src/thirdPartyLibs/CMakeLists.txt @@ -0,0 +1,64 @@ +# This function is used to force a build on a dependant project at cmake configuration phase. +# +function (build_external_project target prefix url) #FOLLOWING ARGUMENTS are the CMAKE_ARGS of ExternalProject_Add + set(trigger_build_dir ${CMAKE_BINARY_DIR}/force_${target}) + #mktemp dir in build tree + file(MAKE_DIRECTORY ${trigger_build_dir} ${trigger_build_dir}/build) + #generate false dependency project + set(CMAKE_LIST_CONTENT " + cmake_minimum_required(VERSION 3.10) + + include(ExternalProject) + ExternalProject_add(${target} + PREFIX ${prefix}/${target} + GIT_REPOSITORY ${url} + CMAKE_ARGS ${ARGN} + ) + + add_custom_target(trigger_${target}) + add_dependencies(trigger_${target} ${target}) + ") + file(WRITE ${trigger_build_dir}/CMakeLists.txt "${CMAKE_LIST_CONTENT}") + execute_process(COMMAND ${CMAKE_COMMAND} .. + WORKING_DIRECTORY ${trigger_build_dir}/build + ) + execute_process(COMMAND ${CMAKE_COMMAND} --build . -j32 + WORKING_DIRECTORY ${trigger_build_dir}/build + ) +endfunction() + +#include(ExternalProject) +#ExternalProject_Add(polytope +# GIT_REPOSITORY https://github.com/pbtoast/polytope +# CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/tpl-install" +# ) + +message("\n---------- BUILDING POLYTOPE ----------") +if(NOT EXISTS ${PROJECT_BINARY_DIR}/tpl-install/include/polytope/polytope.hh) + build_external_project(polytope + ${PROJECT_BINARY_DIR}/tpl-install/ + "https://github.com/pbtoast/polytope" + "-DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/tpl-install" + ) +else() + message(STATUS "Polytope Built") +endif() +list(APPEND spheral_depends polytope) +message("---------------------------------------\n") + +message("\n---------- BUILDING QHULL ----------") +if(NOT EXISTS ${PROJECT_BINARY_DIR}/tpl-install/lib/libqhullstatic.a) + build_external_project(qhull + ${PROJECT_BINARY_DIR}/tpl-install/ + "https://github.com/qhull/qhull" + "-DCMAKE_C_FLAGS=-fPIC -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/tpl-install" + ) +else() + message(STATUS "Qhull Built") +endif() +list(APPEND spheral_depends polytope) +message("--------------------------------------\n") + + + +set(spheral_depends "${spheral_depends}" PARENT_SCOPE) diff --git a/src/thirdPartyLibs/polytope-CMakeLists.patch b/src/thirdPartyLibs/polytope-CMakeLists.patch new file mode 100644 index 000000000..509de1bb2 --- /dev/null +++ b/src/thirdPartyLibs/polytope-CMakeLists.patch @@ -0,0 +1,12 @@ +--- ../../polytope/polytope/src/polytope/CMakeLists-old.txt 2019-12-17 08:51:54.290907000 -0800 ++++ ../../polytope/polytope/src/polytope/CMakeLists.txt 2019-12-17 08:41:43.866962000 -0800 +@@ -135,7 +135,7 @@ + set(PYTHON_EXECUTABLE ${PYTHON_EXE}) + include(FindPythonVersion) + find_python_version() +- string(REPLACE "/bin/python" "" PYTHON_ROOT ${PYTHON_EXE}) ++ string(REPLACE "/bin/python2.7" "" PYTHON_ROOT ${PYTHON_EXE}) + set(PYTHON_INCLUDE_DIR "${PYTHON_ROOT}/include/python${PYTHON_VERSION}") + set(PYTHON_LIB_DIR "${PYTHON_ROOT}/lib") + set(PYTHON_LIBRARY "${PYTHON_LIB_DIR}/libpython.a") + diff --git a/src/thirdPartyLibs/polytope-PYB11-CMakeLists.patch b/src/thirdPartyLibs/polytope-PYB11-CMakeLists.patch new file mode 100644 index 000000000..64c218abf --- /dev/null +++ b/src/thirdPartyLibs/polytope-PYB11-CMakeLists.patch @@ -0,0 +1,20 @@ +--- ../../polytope/polytope/src/polytope/src/PYB11/CMakeLists-old.txt 2019-12-17 13:38:56.342201000 -0800 ++++ ../../polytope/polytope/src/polytope/src/PYB11/CMakeLists.txt 2019-12-17 13:25:01.707132000 -0800 +@@ -56,6 +56,7 @@ + include_directories("${PYTHON_INCLUDE_DIR}") + include_directories("${PYB11_DIR}") + include_directories("${CMAKE_INSTALL_PREFIX}/include") ++include_directories("${PYBIND11_INCLUDE_DIRS}") + + set(PYTHON_LINK "python${PYTHON_VERSION}") + +@@ -85,7 +86,8 @@ + set_target_properties(pypolytope PROPERTIES OUTPUT_NAME polytope) + target_link_libraries(pypolytope + #${PYTHON_LINK} +- ${POLYTOPE_STATIC_LIB} ++ #${POLYTOPE_STATIC_LIB} ++ polytope + ${TRIANGLE_STATIC_LIB} + ${TETGEN_STATIC_LIB}) +