svZeroDSolver
|
svZeroDSolver is written in a highly modular manner to enable reuse of code for many different applications. It is divided into a header based library 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:
svzerodsolver.cpp
pysvzerod.cpp
svzerodcalibrator.cpp
Architecture for svZeroDVisualization.
For debug purposes it is recommended to build svZeroDSolver in Debug mode.
Execute this command in the root folder to install the current source:
This is useful when continuously running the integration tests during development.
NOTE: To contribute new developments to the main branch of svZeroDSolver, developers must first open an issue on the svZeroDSolver Github repository to describe the planned changes.
pip
install and pytest
.CMake
install and can be run by building the tests in svZeroDSolver/tests/test_interface
.The modular architecture of svZeroDSolver relies on "blocks", such as blood vessels, junctions, valves, boundary conditions, etc. These blocks are assembled in a manner specified by the .json
configuration file, which dictates the assembled governing equations for the model. We are always interested in adding new blocks to expand the funcitonality of svZeroDSolver.
Detailed steps required to implement a new block in svZeroDSolver are available here.
Steps required to visualize a new block with svZeroDSolver Visualization application are available here.
We follow the Google C++ Style Guide.
We use clang-format to automatically format our code accoring to the Google Style, as specified in the .clang-format
file. This increases readability and maintainability of the code while enabling you to focus on coding.
There are tools for your favorite IDE to automatically format your code. Examples are:
Before committing any changes, you can run the following command from your build folder to format all your files:
You can also just check if a file would be formatted without actually formatting it with:
If the above commands do not work on your platform (it does not work on Sherlock at Stanford) you can run the following command from the svZeroDSolver folder to format all your files:
The latter check is also performed in the GitHub CI/CD (a.k.a. Actions) and indicates on merge requests when the code doesnt yet meet all style requirements.
On Sherlock at Stanford, clang-format is included in the llvm
module.
We use Doxygen to automatically build an html documentation from source code. Please have at Doxygen's Documentation Guide for an introduction into the syntax of writing documentation in C++. For more inspiration, you can look at the existing source files and how they use documentation.
NOTE: Undocumented code will fail the automated code checks on Github and cannot be merged.
In the following you can find a short recap of the most important commands:
For inline equations use \f$a+b=c\f$
and for block equations use:
If you want to cite a piece literature in your documentation, add a respective BibTeX citation to docs/references.bib
and use \cite name_of_citation
to cite the document.
As the elements of the svZeroDSolver are often represented in the form of electrical circuits, we use CircuiTikZ to draw circuits in the documentation (see blocks in Block for examples). To start a CircuitTikZ drawing use the following command:
The documentation is automatically built in the GitHub CI/CD and published on GitHub pages. If you want to build the documentation locally, you can use:
You can then view the documentation locally in your browser by opening docs/build/html/index.html
.
If you do not have Doxygen install you can do that with brew install doxygen
on macOS or with sudo apt-get install doxygen
on Linux.
Profiling helps to easily identify bottlenecks in the code. A profiling report lists the executation time spend on certain parts of the code. If you experience performance issue with svZeroDSolver, you can follow this guide to create a profiling report. The generation of profiling reports requires Docker to be installed on your machine.
This will generate a file called profiling_report.pdf
in your current working directory.