Skip to content

Commit

Permalink
Bump CVode to 7.1.1 (#625)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-sommer authored Oct 30, 2024
1 parent 5ee1956 commit a045e41
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 20 deletions.
17 changes: 9 additions & 8 deletions build/build_cvode.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
)
args, _ = parser.parse_known_args()

archive = download_file('https://github.com/LLNL/sundials/releases/download/v6.4.1/cvode-6.4.1.tar.gz',
checksum='0a614e7d7d525d9ec88d5a30c887786d7c3681bd123bb6679fb9a4ec5f4609fe')
archive = download_file('https://github.com/LLNL/sundials/releases/download/v7.1.1/cvode-7.1.1.tar.gz',
checksum='36eb0ccea5e223ff4fbc528ef996bfb292ec8a1238019b929290ae5d444520ff')

root = Path(__file__).parent

Expand All @@ -40,8 +40,8 @@

cmake_args = [
'-G', args.cmake_generator,
'-D', 'CMAKE_C_FLAGS_RELEASE=/MT /O2 /Ob2 /DNDEBUG',
'-D', 'CMAKE_C_FLAGS_DEBUG=/MT /Zi /Ob0 /Od /RTC1',
'-D', 'CMAKE_POLICY_DEFAULT_CMP0091=NEW',
'-D', 'CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded'
]

if fmi_architecture == 'x86':
Expand All @@ -66,11 +66,12 @@
['cmake'] +
cmake_args +
['-B', build_dir,
'-D', f'BUILD_SHARED_LIBS=OFF',
'-D', f'BUILD_TESTING=OFF',
'-D', f'EXAMPLES_INSTALL=OFF',
'-D', 'BUILD_SHARED_LIBS=OFF',
'-D', 'BUILD_TESTING=OFF',
'-D', 'EXAMPLES_INSTALL=OFF',
'-D', 'SUNDIALS_ENABLE_ERROR_CHECKS=OFF',
'-D', f'CMAKE_INSTALL_PREFIX={ install_prefix }',
root / 'cvode-6.4.1']
root / 'cvode-7.1.1']
)

check_call([
Expand Down
3 changes: 2 additions & 1 deletion fmusim-gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ target_link_libraries(fmusim-gui PRIVATE
Qt6::WebEngineWidgets
${LIBXML2_DIR}/lib/libxml2.lib
${ZLIB_DIR}/lib/zlib.lib
${CVODE_DIR}/lib/sundials_cvode.lib
${CVODE_DIR}/lib/sundials_cvode_static.lib
${CVODE_DIR}/lib/sundials_core_static.lib
)

# Define target properties for Android with Qt 6 as:
Expand Down
13 changes: 7 additions & 6 deletions fmusim-gui/build/build_cvode.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import tarfile


archive = download_file('https://github.com/LLNL/sundials/releases/download/v6.4.1/cvode-6.4.1.tar.gz',
checksum='0a614e7d7d525d9ec88d5a30c887786d7c3681bd123bb6679fb9a4ec5f4609fe')
archive = download_file('https://github.com/LLNL/sundials/releases/download/v7.1.1/cvode-7.1.1.tar.gz',
checksum='36eb0ccea5e223ff4fbc528ef996bfb292ec8a1238019b929290ae5d444520ff')

root = Path(__file__).parent

Expand All @@ -24,11 +24,12 @@
['cmake'] +
cmake_args +
['-B', build_dir,
'-D', f'BUILD_SHARED_LIBS=OFF',
'-D', f'BUILD_TESTING=OFF',
'-D', f'EXAMPLES_INSTALL=OFF',
'-D', 'BUILD_SHARED_LIBS=OFF',
'-D', 'BUILD_TESTING=OFF',
'-D', 'EXAMPLES_INSTALL=OFF',
'-D', 'SUNDIALS_ENABLE_ERROR_CHECKS=OFF',
'-D', f'CMAKE_INSTALL_PREFIX={ install_prefix }',
str(root / 'cvode-6.4.1')]
str(root / 'cvode-7.1.1')]
)

check_call([
Expand Down
5 changes: 4 additions & 1 deletion fmusim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ if (WIN32)
set(libraries
${LIBXML2_DIR}/lib/libxml2s.lib
${ZLIB_DIR}/lib/zlibstatic.lib
${CVODE_DIR}/lib/sundials_cvode.lib
${CVODE_DIR}/lib/sundials_cvode_static.lib
${CVODE_DIR}/lib/sundials_core_static.lib
wsock32
ws2_32
bcrypt
Expand All @@ -116,6 +117,7 @@ elseif(UNIX AND NOT APPLE)
${LIBXML2_DIR}/lib/libxml2.a
${ZLIB_DIR}lib/libz.a
${CVODE_DIR}/lib/libsundials_cvode.a
${CVODE_DIR}/lib/libsundials_core.a
${CMAKE_DL_LIBS}
m
)
Expand All @@ -124,6 +126,7 @@ else ()
${LIBXML2_DIR}/lib/libxml2.a
${ZLIB_DIR}lib/libz.a
${CVODE_DIR}/lib/libsundials_cvode.a
${CVODE_DIR}/lib/libsundials_core.a
)
endif ()

Expand Down
8 changes: 4 additions & 4 deletions fmusim/FMICVode.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct FMISolverImpl {

SUNContext sunctx;
N_Vector x;
realtype reltol;
sunrealtype reltol;
N_Vector abstol;
SUNMatrix A;
SUNLinearSolver LS;
Expand All @@ -40,7 +40,7 @@ struct FMISolverImpl {
} SolverImpl_;

// Right-hand-side function
static int f(realtype t, N_Vector x, N_Vector ydot, void* user_data) {
static int f(sunrealtype t, N_Vector x, N_Vector ydot, void* user_data) {

FMISolver* solver = (FMISolver*)user_data;

Expand All @@ -60,7 +60,7 @@ static int f(realtype t, N_Vector x, N_Vector ydot, void* user_data) {
}

// Root function
static int g(realtype t, N_Vector x, realtype* gout, void* user_data) {
static int g(sunrealtype t, N_Vector x, sunrealtype* gout, void* user_data) {

FMISolver* solver = (FMISolver*)user_data;

Expand Down Expand Up @@ -113,7 +113,7 @@ FMISolver* FMICVodeCreate(const FMISolverParameters* solverFunctions) {
solver->getEventIndicators = solverFunctions->getEventIndicators;
solver->logError = solverFunctions->logError;

CALL_CVODE(SUNContext_Create(NULL, &solver->sunctx));
CALL_CVODE(SUNContext_Create(SUN_COMM_NULL, &solver->sunctx));

solver->cvode_mem = CVodeCreate(CV_BDF, solver->sunctx);
ASSERT_NOT_NULL(solver->cvode_mem);
Expand Down

0 comments on commit a045e41

Please sign in to comment.