Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add symengine #238 #241

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ set(ENABLE_COVERAGE OFF CACHE BOOL "Enable code coverage")
set(ENABLE_ARRAY_INDEX_CHECKING OFF CACHE BOOL "Enable Array index checking")
set(SV_LOCAL_VTK_PATH "" CACHE STRING "Path to a local build of VTK.")
set(ENABLE_UNIT_TEST OFF CACHE BOOL "Enable Unit Test by Google Test")

set(SV_USE_SYMENGINE OFF CACHE BOOL "Build with the SymEngine symbolic algebra package")
#-----------------------------------------------------------------------------
# RPATH handling
# No objects built directly with project. Not needed!
Expand Down Expand Up @@ -145,6 +145,7 @@ ExternalProject_Add(svFSI
-DSV_EXTERNALS_USE_TOPLEVEL_DIR:BOOL=ON
-DSV_EXTERNALS_TOPLEVEL_DIR:PATH=${SV_EXTERNALS_TOPLEVEL_DIR}
-DSV_USE_TRILINOS:BOOL=${SV_USE_TRILINOS}
-DSV_USE_SYMENGINE:BOOL=${SV_USE_SYMENGINE}
#-DSV_USE_PETSC:BOOL=${SV_USE_PETSC}
-DSV_PETSC_DIR:STRING=${SV_PETSC_DIR}
-DENABLE_COVERAGE:BOOL=${ENABLE_COVERAGE}
Expand Down
1 change: 1 addition & 0 deletions Code/CMake/SimVascularInternals.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set(SV_LIBS
THIRDPARTY_GKLIB_SVFSI
THIRDPARTY_TETGEN
THIRDPARTY_TINYXML
THIRDPARTY_EXPRTK
THIRDPARTY_ZLIB
SVFSILS
SVFSI_CINTERFACE
Expand Down
5 changes: 3 additions & 2 deletions Code/CMake/SimVascularThirdParty.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ endif()
simvascular_third_party(tinyxml)
set(TINYXML_LIBRARY ${SV_LIB_THIRDPARTY_TINYXML_NAME})



# EXPRTK
simvascular_third_party(exprtk)
set(EXPRTK_LIBRARY ${SV_LIB_THIRDPARTY_EXPRTK_NAME})
31 changes: 31 additions & 0 deletions Code/Source/svFSI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
include_directories(${SV_SOURCE_DIR}/ThirdParty/parmetis_svfsi/simvascular_parmetis_svfsi/ParMETISLib)
include_directories(${SV_SOURCE_DIR}/ThirdParty/tetgen/simvascular_tetgen)
include_directories(${SV_SOURCE_DIR}/ThirdParty/tinyxml/simvascular_tinyxml)
include_directories(${SV_SOURCE_DIR}/ThirdParty/exprtk/simvascular_exprtk)
include_directories(${MPI_C_INCLUDE_PATH})

# Find Trilinos package if requested
Expand Down Expand Up @@ -124,6 +125,30 @@ else()

endif()

# Build with the SymEngine library.
if(SV_USE_SYMENGINE)
include(FetchContent)
set(FETCHCONTENT_BASE_DIR "${CMAKE_BINARY_DIR}/ThirdParty/symengine")
FetchContent_Declare(
symengine
GIT_REPOSITORY https://github.com/symengine/symengine.git
GIT_TAG v0.12.0
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
)
set(FETCHCONTENT_QUIET FALSE)
FetchContent_GetProperties(symengine)
if(NOT symengine_POPULATED)
FetchContent_Populate(symengine)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE) # Set the build type for SymEngine
#add_subdirectory(${symengine_SOURCE_DIR} ${symengine_BINARY_DIR})
endif()
message(STATUS "SymEngine fetched from source.")
set(USE_SYMENGINE 1)
else()
set(USE_SYMENGINE 0)
endif()

if(ENABLE_ARRAY_INDEX_CHECKING)
ADD_DEFINITIONS(-DENABLE_ARRAY_INDEX_CHECKING)
endif()
Expand Down Expand Up @@ -238,6 +263,8 @@ if(USE_TRILINOS)
link_directories(${Trilinos_TPL_LIBRARY_DIRS})
endif()



simvascular_add_executable(${SV_SVFSI_EXE}
SRCS ${CSRCS}
DEV_SCRIPT_NAME "mysvfsi"
Expand Down Expand Up @@ -272,6 +299,10 @@ if(USE_PETSC)
target_link_libraries(${SV_SVFSI_EXE} ${PETSC_LIBRARY_DIRS})
endif()

if(USE_SYMENGINE)
target_link_libraries(${SV_SVFSI_EXE} symengine)
endif()

# coverage
if(ENABLE_COVERAGE)
# set compiler flags
Expand Down
2 changes: 2 additions & 0 deletions Code/ThirdParty/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Applications

eigen - A header-only application for matrix objects.

exprtk - A header-only application for parsing and evaluating mathematical expressions.

gklib_svfsi - A library used by METIS and ParMETIS applications.

metis_svfsi - The METIS mesh partitioning application used by ParMETIS.
Expand Down
31 changes: 31 additions & 0 deletions Code/ThirdParty/exprtk/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright (c) Stanford University, The Regents of the University of
# California, and others.
#
# All Rights Reserved.
#
# See Copyright-SimVascular.txt for additional details.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject
# to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

simvascular_third_party(exprtk)
43 changes: 43 additions & 0 deletions Code/ThirdParty/exprtk/simvascular_exprtk.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/* Copyright (c) Stanford University, The Regents of the University of
* California, and others.
*
* All Rights Reserved.
*
* See Copyright-SimVascular.txt for additional details.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef __simvascular_exprtk_h
#define __simvascular_exprtk_h

/* Use the exprtk library configured for SimVascular. */
#cmakedefine SV_USE_SYSTEM_EXPRTK
#ifdef SV_USE_SYSTEM_EXPRTK
# include <exprtk.h>
#else
# include <simvascular_exprtk/exprtk.h>
#endif

#endif
57 changes: 57 additions & 0 deletions Code/ThirdParty/exprtk/simvascular_exprtk/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Copyright (c) Stanford University, The Regents of the University of
# California, and others.
#
# All Rights Reserved.
#
# See Copyright-SimVascular.txt for additional details.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject
# to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Set the minimum required version of cmake for a project.
cmake_minimum_required(VERSION 3.10)
project(EXPRTK)

# source files for exprtk
SET(SRCS exprtk.cpp)
SET(HDRS exprtk.h)

set(lib ${SV_LIB_THIRDPARTY_EXPRTK_NAME})
if(SV_USE_THIRDPARTY_SHARED_LIBRARIES)
add_library(${lib} SHARED ${SRCS} ${HDRS})
else()
add_library(${lib} STATIC ${SRCS} ${HDRS})
endif()

if(SV_INSTALL_LIBS)
install(TARGETS ${lib}
RUNTIME DESTINATION ${SV_INSTALL_RUNTIME_DIR} COMPONENT ThirdPartyExecutables
LIBRARY DESTINATION ${SV_INSTALL_LIBRARY_DIR} COMPONENT ThirdPartyLibraries
ARCHIVE DESTINATION ${SV_INSTALL_ARCHIVE_DIR} COMPONENT ThirdPartyLibraries
)
endif()
if(SV_INSTALL_HEADERS)
install(FILES ${HDRS}
DESTINATION ${SV_INSTALL_INCLUDE_DIR}/thirdparty/exprtk COMPONENT ThirdPartyHeaders
)
endif()
15 changes: 15 additions & 0 deletions Code/ThirdParty/exprtk/simvascular_exprtk/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#
# **************************************************************
# * C++ Mathematical Expression Toolkit Library *
# * *
# * Author: Arash Partow (1999-2023) *
# * URL: https://www.partow.net/programming/exprtk/index.html *
# * *
# * Copyright notice: *
# * Free use of the Mathematical Expression Toolkit Library is *
# * permitted under the guidelines and in accordance with the *
# * most current version of the MIT License. *
# * http://www.opensource.org/licenses/MIT *
# * *
# **************************************************************
#
1 change: 1 addition & 0 deletions Code/ThirdParty/exprtk/simvascular_exprtk/exprtk.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// dummy file
Loading
Loading