Skip to content

Commit 5dbb4ab

Browse files
menon-karthikmrp089ncdornzasextonphilipcardiff
authored
Rebase recent commits and update license (after resolving merge conflicts) (#180)
Co-authored-by: menon-karthik <[email protected]> Co-authored-by: Martin Pfaller <[email protected]> Co-authored-by: Nick Dorn <[email protected]> Co-authored-by: Zachary Sexton <[email protected]> Co-authored-by: Philip Cardiff <[email protected]>
1 parent 4d8bf34 commit 5dbb4ab

File tree

88 files changed

+464
-2241
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+464
-2241
lines changed

.github/workflows/test.yml

Lines changed: 86 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,48 +7,86 @@ jobs:
77
runs-on: ${{ matrix.os }}
88
strategy:
99
matrix:
10-
os: [ubuntu-22.04, ubuntu-latest, macos-13, macos-latest]
10+
os: [ubuntu-22.04, ubuntu-latest, macos-13, macos-latest, windows-latest]
1111
version: [13] # GCC version
1212
fail-fast: false
1313
env:
1414
GCC_V: ${{ matrix.version }}
15+
CONDA_ENV: zerod
16+
PYTHONPATH: ${{ github.workspace }}
1517
steps:
1618
- uses: actions/checkout@v4
1719
- uses: conda-incubator/setup-miniconda@v3
1820
with:
1921
auto-update-conda: true
22+
activate-environment: ${{env.CONDA_ENV}}
23+
python-version: "3.11.4"
2024
- name: Install ubuntu dependencies
2125
if: startsWith(matrix.os, 'ubuntu')
2226
run: sudo apt update && sudo apt install build-essential cmake lcov
23-
- name: Create conda environment
24-
run: |
25-
#export PATH="/usr/share/miniconda/bin:$PATH"
26-
#alias conda="$CONDA/bin/conda"
27-
conda create -n zerod python=3.11.4
27+
2828
- name: Install dependencies to get correct version numbers (Ubuntu)
2929
if: startsWith(matrix.os, 'ubuntu')
30-
run: conda install -n zerod -c conda-forge libstdcxx-ng=${GCC_V} gcc=${GCC_V}
30+
run: conda install -c conda-forge libstdcxx-ng=${GCC_V} gcc=${GCC_V}
31+
3132
- name: Install dependencies to get correct version numbers (MacOS)
3233
if: startsWith(matrix.os, 'macos')
3334
run: |
3435
brew install gcc@${GCC_V}
3536
ln -s /usr/local/bin/gcc-${GCC_V} /usr/local/bin/gcc
36-
- name: Install svZeroDSolver
37-
run: conda run -n zerod pip install -e ".[dev]"
37+
38+
- name: Install dependencies for windows
39+
if: startsWith(matrix.os, 'windows')
40+
shell: pwsh
41+
run: |
42+
choco install mingw --no-progress
43+
conda install -y -c conda-forge cmake graphviz python-graphviz pydot
44+
pip install --upgrade cmake-setuptools
45+
46+
- name: Install POISX-like svZeroDSolver
47+
if: ${{!startsWith(matrix.os, 'windows')}}
48+
run: conda run pip install -e ".[dev]"
49+
50+
- name: Install Windows svZeroDSolver
51+
if: startsWith(matrix.os, 'windows')
52+
shell: pwsh
53+
run: |
54+
$Env:CMAKE_GENERATOR = 'MinGW Makefiles'
55+
Write-Host "→ Using CMAKE_GENERATOR = $Env:CMAKE_GENERATOR"
56+
pip install --no-build-isolation -v .[dev]
57+
pip show pysvzerod
58+
3859
- name: Install Networkx
3960
run: |
40-
conda run -n zerod pip install networkx
61+
conda run pip install networkx
62+
4163
- name: Test the build
4264
run: |
4365
cd tests
44-
conda run -n zerod pytest -v --durations=0 --ignore=test_dirgraph.py
45-
- name: Build using CMake
66+
conda run pytest -v --durations=0 --ignore=test_dirgraph.py
67+
68+
- name: Build using CMake for POISX-like Systems
69+
if: ${{!startsWith(matrix.os, 'windows')}}
4670
run: |
4771
mkdir Release
4872
cd Release
4973
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_DISTRIBUTION=ON ..
5074
make -j2
51-
- name: Test interface
75+
76+
- name: Build using CMake for Windows Systems
77+
if: startsWith(matrix.os, 'windows')
78+
shell: pwsh
79+
run: |
80+
mkdir Release
81+
cd Release
82+
cmake -G "MinGW Makefiles" `
83+
-DCMAKE_BUILD_TYPE=Release `
84+
-DENABLE_DISTRIBUTION=ON `
85+
..
86+
cmake --build . --parallel 2
87+
88+
- name: Test interface POISX-like Systems
89+
if: ${{!startsWith(matrix.os, 'windows')}}
5290
run: |
5391
cd tests/test_interface
5492
mkdir build_tests
@@ -59,32 +97,65 @@ jobs:
5997
./svZeroD_interface_test01 ../../../../Release ../../test_01/svzerod_3Dcoupling.json
6098
cd ../test_02
6199
./svZeroD_interface_test02 ../../../../Release ../../test_02/svzerod_tuned.json
100+
101+
- name: Test interface Windows Systems
102+
if: startsWith(matrix.os, 'windows')
103+
shell: pwsh
104+
run: |
105+
cd tests/test_interface
106+
mkdir build_tests
107+
cd build_tests
108+
cmake -G "MinGW Makefiles" ..
109+
cmake --build . --parallel 2
110+
cd test_01
111+
./svZeroD_interface_test01.exe `
112+
../../../../Release `
113+
../../test_01/svzerod_3Dcoupling.json
114+
115+
cd ../test_02
116+
./svZeroD_interface_test02 `
117+
../../../../Release `
118+
../../test_02/svzerod_tuned.json
119+
62120
- name: Generate code coverage
63121
if: startsWith(matrix.os, 'ubuntu-22.04')
64122
run: |
65123
cd Release
66124
cmake -DENABLE_COVERAGE=ON ..
67125
make -j2
68126
cd ../tests
69-
conda run -n zerod pytest -v --durations=0 --coverage --ignore=test_dirgraph.py
127+
conda run pytest -v --durations=0 --coverage --ignore=test_dirgraph.py
70128
cd ../Release
71129
make coverage
130+
72131
- name: Save coverage report
73132
if: startsWith(matrix.os, 'ubuntu-22.04')
74133
uses: actions/upload-artifact@v4
75134
with:
76135
name: coverage_report
77136
path: Release/coverage
137+
78138
- name: Upload coverage reports to Codecov
79139
if: startsWith(matrix.os, 'ubuntu-22.04')
80140
uses: codecov/codecov-action@v4
81141
env:
82142
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
83-
- name: Build installer
143+
144+
- name: Build installer POISX-like Systems
145+
if: ${{!startsWith(matrix.os, 'windows')}}
84146
run: |
85147
cd Release
86148
cpack
87149
cp distribution/svZeroDSolver_* ..
150+
151+
- name: Build installer Windows Systems
152+
if: startsWith(matrix.os, 'windows')
153+
shell: pwsh
154+
run: |
155+
cd Release
156+
cpack
157+
Copy-Item distribution\svZeroDSolver_* -Destination ..\
158+
88159
- name: Upload installer
89160
uses: actions/upload-artifact@v4
90161
with:

CMakeLists.txt

Lines changed: 69 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,5 @@
1-
# Copyright (c) Stanford University, The Regents of the University of
2-
# California, and others.
3-
#
4-
# All Rights Reserved.
5-
#
6-
# See Copyright-SimVascular.txt for additional details.
7-
#
8-
# Permission is hereby granted, free of charge, to any person obtaining
9-
# a copy of this software and associated documentation files (the
10-
# "Software"), to deal in the Software without restriction, including
11-
# without limitation the rights to use, copy, modify, merge, publish,
12-
# distribute, sublicense, and/or sell copies of the Software, and to
13-
# permit persons to whom the Software is furnished to do so, subject
14-
# to the following conditions:
15-
#
16-
# The above copyright notice and this permission notice shall be included
17-
# in all copies or substantial portions of the Software.
18-
#
19-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20-
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21-
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22-
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
23-
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24-
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25-
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26-
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27-
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28-
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29-
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1+
# SPDX-FileCopyrightText: Copyright (c) Stanford University, The Regents of the University of California, and others.
2+
# SPDX-License-Identifier: BSD-3-Clause
303

314
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
325
cmake_minimum_required(VERSION 3.5)
@@ -58,6 +31,22 @@ if(ENABLE_COVERAGE)
5831
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
5932
endif()
6033

34+
if (WIN32 AND MSVC)
35+
# CMake ≥ 3.15 has a proper variable
36+
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15")
37+
set(CMAKE_MSVC_RUNTIME_LIBRARY
38+
"MultiThreaded$<$<CONFIG:Debug>:Debug>")
39+
else()
40+
# CMake < 3.15: manually swap /MD → /MT in all flags for static
41+
# versions of the runtime libraries
42+
foreach(_var
43+
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
44+
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
45+
CMAKE_SHARED_LINKER_FLAGS)
46+
string(REPLACE "/MD" "/MT" ${_var} "${${_var}}")
47+
endforeach()
48+
endif()
49+
endif()
6150
# -----------------------------------------------------------------------------
6251
# Set the location to store the binaries and libraries created by this project.
6352
# -----------------------------------------------------------------------------
@@ -159,7 +148,38 @@ add_executable(svzerodcalibrator applications/svzerodcalibrator.cpp
159148
# -----------------------------------------------------------------------------
160149
# Replace EXCLUDE_FROM_ALL with SHARED to test building the Python
161150
# shared library.
162-
pybind11_add_module(pysvzerod EXCLUDE_FROM_ALL applications/pysvzerod.cpp)
151+
152+
pybind11_add_module(pysvzerod applications/pysvzerod.cpp)
153+
if(WIN32 AND "${CMAKE_GENERATOR}" STREQUAL "MinGW Makefiles")
154+
message(STATUS ">> Applying static‑link flags to pysvzerod")
155+
156+
include(CheckCXXCompilerFlag)
157+
set(_static_flags
158+
-static
159+
-static-libgcc
160+
-static-libstdc++
161+
)
162+
# test for winpthread support before adding
163+
check_cxx_compiler_flag("-static-libwinpthread" HAVE_WINPTHREAD)
164+
if(HAVE_WINPTHREAD)
165+
list(APPEND _static_flags -static-libwinpthread)
166+
else()
167+
find_package(Threads REQUIRED)
168+
target_link_libraries(pysvzerod PRIVATE Threads::Threads)
169+
endif()
170+
# apply to compile *and* link
171+
foreach(_f IN LISTS _static_flags)
172+
target_compile_options(pysvzerod PRIVATE ${_f})
173+
# CMake ≥3.13:
174+
target_link_options (pysvzerod PRIVATE ${_f})
175+
endforeach()
176+
177+
# verify in the configure log for static compilation:
178+
get_target_property(_ccopts pysvzerod COMPILE_OPTIONS)
179+
message(STATUS ">>> pysvzerod COMPILE_OPTIONS = ${_ccopts}")
180+
get_target_property(_lnkopts pysvzerod LINK_OPTIONS)
181+
message(STATUS ">>> pysvzerod LINK_OPTIONS = ${_lnkopts}")
182+
endif()
163183

164184
# -----------------------------------------------------------------------------
165185
# Add source sub-directories.
@@ -232,3 +252,22 @@ add_custom_target(codeformat
232252
# check code format
233253
add_custom_target(codecheck
234254
COMMAND find ${SDIR}/*.h ${SDIR}/*.cpp | xargs clang-format -style=file:${PROJECT_SOURCE_DIR}/.clang-format --dry-run --Werror)
255+
256+
set_target_properties(pysvzerod PROPERTIES
257+
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/python
258+
)
259+
260+
# standard install target locations
261+
install(TARGETS pysvzerod
262+
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
263+
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
264+
RUNTIME DESTINATION "${CMAKE_INSTALL_LIBDIR}"
265+
)
266+
267+
# append correct suffix for windows python runtime files
268+
if (WIN32)
269+
set_target_properties(pysvzerod PROPERTIES
270+
PREFIX ""
271+
SUFFIX ".pyd"
272+
)
273+
endif()

LICENSE.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
Copyright (c) Stanford University, The Regents of the University of California, and others.
1+
Copyright 2016-2025 Stanford University, The Regents of the University of California, and others.
22

3-
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:
3+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
44

5-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
66

7-
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.
7+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8+
9+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10+
11+
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 HOLDER 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.

applications/pysvzerod.cpp

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,5 @@
1-
// Copyright (c) Stanford University, The Regents of the University of
2-
// California, and others.
3-
//
4-
// All Rights Reserved.
5-
//
6-
// See Copyright-SimVascular.txt for additional details.
7-
//
8-
// Permission is hereby granted, free of charge, to any person obtaining
9-
// a copy of this software and associated documentation files (the
10-
// "Software"), to deal in the Software without restriction, including
11-
// without limitation the rights to use, copy, modify, merge, publish,
12-
// distribute, sublicense, and/or sell copies of the Software, and to
13-
// permit persons to whom the Software is furnished to do so, subject
14-
// to the following conditions:
15-
//
16-
// The above copyright notice and this permission notice shall be included
17-
// in all copies or substantial portions of the Software.
18-
//
19-
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20-
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21-
// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22-
// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
23-
// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24-
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25-
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26-
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27-
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28-
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29-
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1+
// SPDX-FileCopyrightText: Copyright (c) Stanford University, The Regents of the University of California, and others.
2+
// SPDX-License-Identifier: BSD-3-Clause
303
/**
314
* @file pysvzerod.cpp
325
* @brief Python interface for svZeroDSolver

applications/svZeroDGUI/static/js/app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// SPDX-FileCopyrightText: Copyright (c) Stanford University, The Regents of the University of California, and others.
2+
// SPDX-License-Identifier: BSD-3-Clause
13
/**
24
* app.js
35
*

applications/svZeroDGUI/static/js/cytoscape-edgehandles.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// SPDX-FileCopyrightText: Copyright (c) Stanford University, The Regents of the University of California, and others.
2+
// SPDX-License-Identifier: BSD-3-Clause
13
/**
24
* cytoscape-edgehandles.js
35
*
@@ -1168,4 +1170,4 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_14__;
11681170

11691171
/***/ })
11701172
/******/ ]);
1171-
});
1173+
});

applications/svZeroDVisualization/dirgraph_connections.py

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,7 @@
11
# coding=utf-8
22

3-
# Copyright (c) Stanford University, The Regents of the University of
4-
# California, and others.
5-
#
6-
# All Rights Reserved.
7-
#
8-
# See Copyright-SimVascular.txt for additional details.
9-
#
10-
# Permission is hereby granted, free of charge, to any person obtaining
11-
# a copy of this software and associated documentation files (the
12-
# "Software"), to deal in the Software without restriction, including
13-
# without limitation the rights to use, copy, modify, merge, publish,
14-
# distribute, sublicense, and/or sell copies of the Software, and to
15-
# permit persons to whom the Software is furnished to do so, subject
16-
# to the following conditions:
17-
#
18-
# The above copyright notice and this permission notice shall be included
19-
# in all copies or substantial portions of the Software.
20-
#
21-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22-
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23-
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
24-
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
25-
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26-
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27-
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28-
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29-
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30-
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31-
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3+
# SPDX-FileCopyrightText: Copyright (c) Stanford University, The Regents of the University of California, and others.
4+
# SPDX-License-Identifier: BSD-3-Clause
325

336
import numpy as np
347
from dirgraph_wire import wire

0 commit comments

Comments
 (0)