Skip to content

Commit

Permalink
Merge branch 'SimVascular:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
rjrios915 authored Oct 15, 2024
2 parents f7aabf6 + e3d4baa commit 7455579
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_visualization.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
test:
strategy:
matrix:
os: [ubuntu-22.04, macos-13]
os: [ubuntu-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}

Expand Down
8 changes: 5 additions & 3 deletions distribution/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,19 @@ if(ENABLE_DISTRIBUTION)
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}")

# define install location
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local/sv/ZeroDSolver/${CPACK_PACKAGE_VERSION}")
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local/sv/svZeroDSolver/${CPACK_PACKAGE_VERSION}")

# define install target within build folder
set(CPACK_OUTPUT_FILE_PREFIX ${CMAKE_BINARY_DIR}/distribution)

if(APPLE)
set(CPACK_GENERATOR "productbuild")
elseif(LINUX)
endif()

if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(CPACK_GENERATOR DEB)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "")
endif(APPLE)
endif()

# create the installer for both solver and calibrator
install(TARGETS svzerodsolver svzerodcalibrator
Expand Down
8 changes: 7 additions & 1 deletion docs/pages/developer_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@ in the `src` directory and a collection of different applications in the
`applications` folder. Each application is written for a different use-case
of svZeroDSolver, namely:

* svZeroDCalibrator in `svzerodcalibrator.cpp`
* svZerodSolver in `svzerodsolver.cpp`
* Python API in `pysvzerod.cpp`
* svZeroDCalibrator in `svzerodcalibrator.cpp`
* svZeroDVisualization for visualizing 0D models and results
* svZeroDGUI for creating new 0D models grahically.

[Architecture for svZeroDVisualization](@ref visualization).

[Architecture for svZeroDGUI](@ref GUI).


# Build in debug mode
Expand Down
31 changes: 16 additions & 15 deletions docs/pages/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ cmake --build .
<summary>**Building on Sherlock**</summary>

```bash
module load cmake/3.23.1 gcc/12.1.0 binutils/2.38
module load cmake/3.23.1 gcc/14.2.0 binutils/2.38
mkdir Release
cd Release
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=/share/software/user/open/gcc/12.1.0/bin/g++ -DCMAKE_C_COMPILER=/share/software/user/open/gcc/12.1.0/bin/gcc ..
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=/share/software/user/open/gcc/14.2.0/bin/g++ -DCMAKE_C_COMPILER=/share/software/user/open/gcc/14.2.0/bin/gcc ..
cmake --build .
```

Expand Down Expand Up @@ -334,7 +334,7 @@ Coronary outlet | OpenLoopCoronaryBC | `CORONARY`

The above table describes the most commonly used boundary conditions. In addition, svZeroDSolver includes various closed-loop boundary conditions. Examples can be found in `svZeroDSolver/tests/cases`.

Note that the `FLOW` and `PRESSURE` boundary conditions accept mathematical expressions in `bc_values`. For example, values of the boundary condition can be specified as a function of time as follow:
Values of the boundary condition can be specified as a function of time as follow:
```python
{
"bc_name": "INFLOW", # Name of the boundary condition
Expand All @@ -347,21 +347,22 @@ Note that the `FLOW` and `PRESSURE` boundary conditions accept mathematical expr
```
See `svZeroDSolver/tests/cases/pulsatileFlow_R_RCR.json` for an example.

They can also be specified as a mathematica expression as follow:
```python
{
"bc_name": "INFLOW", # Name of the boundary condition
"bc_type": "FLOW", # Type of the boundary condition
"bc_values": {
"fn": "2.0 * (4*atan(1.)) * cos(2.0 * (4*atan(1.)) * t)"
}
},
```
For an example with a mathematical expression for the boundary condition, see `svZeroDSolver/tests/cases/timeDep_Flow.json`.
<!--Uncomment below when the time-varying functionailty is merged-->
<!--For `FLOW` and `PRESSURE` boundary conditions, they can also be specified as a mathematical expression as follow: -->
<!--```python-->
<!--{-->
<!-- "bc_name": "INFLOW", # Name of the boundary condition-->
<!-- "bc_type": "FLOW", # Type of the boundary condition-->
<!-- "bc_values": {-->
<!-- "fn": "2.0 * (4*atan(1.)) * cos(2.0 * (4*atan(1.)) * t)"-->
<!-- }-->
<!--},-->
<!--```-->
<!--For an example with a mathematical expression for the boundary condition, see `svZeroDSolver/tests/cases/timeDep_Flow.json`. -->

## Simulation Outputs

The siumulation outputs will be saved in the specified CSV file (`<name_of_output_file>.csv`) when running `svZeroDSolver` from the command line as follows:
The simulation outputs will be saved in the specified CSV file (`<name_of_output_file>.csv`) when running `svZeroDSolver` from the command line as follows:
```bash
svzerodsolver <name_of_configuration_file>.json <name_of_output_file>.csv
```
Expand Down
28 changes: 25 additions & 3 deletions tests/test_dirgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,30 @@ def test_directed_graph_generation(setup_files):

generated_dot_file_path = tmp_path / (os.path.splitext(os.path.basename(input_file_path))[0] + "_directed_graph.dot")

assert filecmp.cmp(generated_dot_file_path, expected_dot_file_path), \
f"The generated dot file '{generated_dot_file_path}' does not match the expected dot file '{expected_dot_file_path}'."
# Open the expected and generated dot files to compare line-by-line
with open(generated_dot_file_path, 'r') as generated_dot_file:
with open(expected_dot_file_path, 'r') as expected_dot_file:
generated_lines = generated_dot_file.readlines()
expected_lines = expected_dot_file.readlines()
match = True
# Check if number of lines is equal in each file
if len(generated_lines) == len(expected_lines):
for line_num in range(len(generated_lines)):
# Remove spaces and other characters that should not be in the comparison
clean_generated_line = " ".join(generated_lines[line_num].split())
clean_expected_line = " ".join(expected_lines[line_num].split())
# Compare lines and print line that do not match
if clean_generated_line != clean_expected_line:
print("\nThe following line does not match:")
print("--- Generated dot file:", clean_generated_line)
print("--- Expected dot file:", clean_expected_line)
match = False

else:
raise RuntimeError(f"ERROR: The generated dot file '{generated_dot_file_path}' and the expected dot file '{expected_dot_file_path}' do not have the same number of lines.")

if not match:
raise RuntimeError(f"The generated dot file '{generated_dot_file_path}' does not match the expected dot file '{expected_dot_file_path}'.")

if __name__ == "__main__":
pytest.main()
pytest.main()

0 comments on commit 7455579

Please sign in to comment.