├── .github └── workflows │ ├── build.yml │ └── test.yml ├── .gitignore ├── BuildWithMake ├── .gitignore ├── Makefile ├── Makefile.cygwin ├── Makefile.darwin ├── Release │ ├── License.rtf │ ├── Makefile │ ├── developer_wrapper_scripts │ │ ├── developer-core-script │ │ ├── developer-svpost-script │ │ ├── developer-svpre-script │ │ ├── developer-svsolver-mpi-linux-script │ │ ├── developer-svsolver-mpi-macosx-script │ │ ├── developer-svsolver-mpi-windows-script │ │ ├── developer-svsolver-nompi-linux-script │ │ ├── developer-svsolver-nompi-macosx-script │ │ └── developer-svsolver-nompi-windows-script │ ├── linux_wrapper_scripts │ │ ├── linux-dist-core-script │ │ ├── linux-dist-svpost-script │ │ ├── linux-dist-svpre-script │ │ ├── linux-dist-svsolver-mpi-script │ │ └── linux-dist-svsolver-nompi-script │ ├── platform_independent_scripts │ │ ├── generic-launch-script │ │ ├── post-install.sh │ │ ├── post-solver-install.sh │ │ └── post-svsolver-install.sh │ ├── tcl_helper_scripts │ │ ├── create_tclIndex.tcl │ │ └── d2u_files.tcl │ ├── windows_installer_packages │ │ ├── .wix-simvascular-svsolver-bundle.wxs.swp │ │ ├── msi-logo.png │ │ ├── wix-simvascular-svonedsolver-bundle.wxs │ │ └── wix-simvascular-svonedsolver-bundle.wxs~ │ ├── windows_msi_helpers │ │ ├── makewxs-svonedsolver.tcl │ │ ├── makewxs-svonedsolver.tcl~ │ │ ├── msi-banner.bmp │ │ ├── msi-banner.jpg │ │ ├── msi-dialog.bmp │ │ ├── msi-dialog.jpg │ │ ├── simvascular.ico │ │ └── uuidgen.c │ └── windows_wrapper_scripts │ │ ├── windows-dist-core-script │ │ ├── windows-dist-svpost-script │ │ ├── windows-dist-svpre-script │ │ ├── windows-dist-svsolver-mpi-script │ │ └── windows-dist-svsolver-nompi-script ├── build_windows_github.bat ├── include.mk ├── windows-build.sh └── wix-3.11.x64_cygwin.mk ├── CMakeLists.txt ├── Code └── Source │ ├── CMakeLists.txt │ ├── cvOneDBFSolver.cxx │ ├── cvOneDBFSolver.h │ ├── cvOneDComplex.cxx │ ├── cvOneDComplex.h │ ├── cvOneDDataTable.cxx │ ├── cvOneDDataTable.h │ ├── cvOneDDenseMatrix.cxx │ ├── cvOneDDenseMatrix.h │ ├── cvOneDEnums.h │ ├── cvOneDError.cxx │ ├── cvOneDError.h │ ├── cvOneDException.cxx │ ├── cvOneDException.h │ ├── cvOneDFEAJoint.h │ ├── cvOneDFEAMatrix.cxx │ ├── cvOneDFEAMatrix.h │ ├── cvOneDFEAVector.cxx │ ├── cvOneDFEAVector.h │ ├── cvOneDFiniteElement.cxx │ ├── cvOneDFiniteElement.h │ ├── cvOneDGlobal.cxx │ ├── cvOneDGlobal.h │ ├── cvOneDJoint.h │ ├── cvOneDLinearSolver.cxx │ ├── cvOneDLinearSolver.h │ ├── cvOneDMaterial.h │ ├── cvOneDMaterialLinear.cxx │ ├── cvOneDMaterialLinear.h │ ├── cvOneDMaterialManager.cxx │ ├── cvOneDMaterialManager.h │ ├── cvOneDMaterialOlufsen.cxx │ ├── cvOneDMaterialOlufsen.h │ ├── cvOneDMatrix.h │ ├── cvOneDMesh.h │ ├── cvOneDModel.cxx │ ├── cvOneDModel.h │ ├── cvOneDModelManager.cxx │ ├── cvOneDModelManager.h │ ├── cvOneDMthBranchModel.cxx │ ├── cvOneDMthBranchModel.h │ ├── cvOneDMthModelBase.cxx │ ├── cvOneDMthModelBase.h │ ├── cvOneDMthSegmentModel.cxx │ ├── cvOneDMthSegmentModel.h │ ├── cvOneDNode.h │ ├── cvOneDOptions.cxx │ ├── cvOneDOptions.h │ ├── cvOneDOptionsJsonParser.cxx │ ├── cvOneDOptionsJsonParser.h │ ├── cvOneDOptionsJsonSerializer.cxx │ ├── cvOneDOptionsJsonSerializer.h │ ├── cvOneDOptionsLegacySerializer.cxx │ ├── cvOneDOptionsLegacySerializer.h │ ├── cvOneDSegment.cxx │ ├── cvOneDSegment.h │ ├── cvOneDSkylineLinearSolver.cxx │ ├── cvOneDSkylineLinearSolver.h │ ├── cvOneDSkylineMatrix.cxx │ ├── cvOneDSkylineMatrix.h │ ├── cvOneDSolverDefinitions.h │ ├── cvOneDString.cxx │ ├── cvOneDString.h │ ├── cvOneDSubdomain.cxx │ ├── cvOneDSubdomain.h │ ├── cvOneDTypes.h │ ├── cvOneDUtility.cxx │ ├── cvOneDUtility.h │ ├── cvOneDVector.h │ ├── header │ ├── main.cxx │ ├── oneDSolver.i │ ├── rename.sh │ └── sparse │ ├── csparse │ ├── csparse.c │ ├── csparse.h │ ├── csparseSolve.cxx │ └── csparseSolve.h │ ├── cvOneDSparseLinearSolver.cxx │ ├── cvOneDSparseLinearSolver.h │ ├── cvOneDSparseMatrix.cxx │ ├── cvOneDSparseMatrix.h │ └── superlu │ ├── pdutil.c │ ├── sp_ienv.c │ ├── st_to_cc.cxx │ ├── st_to_cc.h │ ├── superLUSolve.cxx │ └── superLUSolve.h ├── Copyright-SimVascular.txt ├── Distribution ├── CMakeLists.txt ├── setup-linux.in └── setup-macos.in ├── Glossary ├── README.md ├── Tests ├── SystemTests │ ├── .gitignore │ ├── __init__.py │ ├── cases │ │ ├── 02_simpleArtery_Resistance.in │ │ ├── 04_simpleArtery_Pressure.in │ │ ├── 05_bifurcation_RCR.in │ │ ├── 12_AortoFem_Pulse_R.in │ │ ├── 14_AortoFem_Pulse_RCR.in │ │ ├── Left_coronary_inlet_pressure_wave_outlet_coronary.in │ │ ├── bifurcation_P.in │ │ ├── bifurcation_R.in │ │ ├── bifurcation_RCR.in │ │ ├── bifurcation_RCR_staticFunc.in │ │ ├── bifurcation_R_stab.in │ │ ├── tube_pressure.in │ │ ├── tube_pressure_wave.in │ │ ├── tube_r.in │ │ ├── tube_r_Pd.in │ │ ├── tube_r_stab.in │ │ ├── tube_rcr.in │ │ ├── tube_rcr_Pd.in │ │ └── tube_stenosis_r.in │ ├── conftest.py │ ├── plots.py │ └── test_integration.py └── UnitTests │ ├── ExampleTest.cxx │ ├── OptionsTestHelpers.cxx │ ├── OptionsTestHelpers.hpp │ ├── TestFiles │ ├── BifurcationR.in │ ├── ExampleFile.txt │ ├── SimpleArtery.in │ └── TestInput.json │ ├── TestJsonSerialization.cxx │ └── TestLegacySerializer.cxx ├── cmake ├── External_PCRE.cmake ├── FindSphinx.cmake ├── SimVascularMacros.cmake ├── SimVascularSystemSetup.cmake ├── UseSWIG.cmake ├── installSwig.cmake ├── pcre_configure_step.cmake.in └── swig_configure_step.cmake.in ├── docs ├── .gitignore ├── CMakeLists.txt ├── _themes │ └── sphinx_rtd_theme │ │ ├── __init__.py │ │ ├── breadcrumbs.html │ │ ├── footer.html │ │ ├── layout.html │ │ ├── search.html │ │ ├── searchbox.html │ │ ├── static │ │ ├── css │ │ │ ├── badge_only.css │ │ │ └── theme.css │ │ ├── fonts │ │ │ ├── FontAwesome.otf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.svg │ │ │ ├── fontawesome-webfont.ttf │ │ │ ├── fontawesome-webfont.woff │ │ │ └── fontawesome-webfont.woff2 │ │ └── js │ │ │ ├── modernizr.min.js │ │ │ └── theme.js │ │ ├── theme.conf │ │ └── versions.html └── source │ ├── conf.py.in │ ├── content │ ├── Images │ │ ├── bifurcation_rcr_results.png │ │ ├── tube_r_results.png │ │ └── tube_r_schematic.png │ ├── about.rst │ ├── inputFileGuide.rst │ ├── installation.rst │ ├── pythonScripting.rst │ ├── test_bifurcation_rcr.rst │ ├── test_tube_r.rst │ ├── theory.rst │ ├── tutorials.rst │ └── userGuide.rst │ └── index.rst └── py ├── .gitignore ├── CMakeLists.txt ├── oneDSolver.tmp └── scripts ├── fileTemplate.py ├── runParallelSolver.py ├── simResultRecord.py └── testRunSolver.py /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: test 2 | on: [push, pull_request] 3 | jobs: 4 | test: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@v3 8 | - name: build solver 9 | shell: bash 10 | run: | 11 | sudo apt-get -y install libboost-all-dev 12 | mkdir build_skyline 13 | cd build_skyline 14 | cmake .. 15 | make 16 | - name: install dependencies 17 | run: | 18 | pip install pytest pytest-cov pytest-mock pytest-xdist 19 | pip install numpy 20 | - name: result simulation system tests 21 | run: | 22 | # We're providing the path to the EXE based on the prior build solver step. 23 | pytest Tests/SystemTests -n auto --relativeExePath="build_skyline/bin/OneDSolver" 24 | - name: result unit tests 25 | run: | 26 | cd build_skyline 27 | ctest 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | 3 | # Prerequisites 4 | *.d 5 | *.DS_STORE 6 | 7 | # Compiled Object files 8 | *.slo 9 | *.lo 10 | *.o 11 | *.obj 12 | 13 | # Precompiled Headers 14 | *.gch 15 | *.pch 16 | 17 | # Compiled Dynamic libraries 18 | *.so 19 | *.dylib 20 | *.dll 21 | 22 | # Fortran module files 23 | *.mod 24 | *.smod 25 | 26 | # Compiled Static libraries 27 | *.lai 28 | *.la 29 | *.a 30 | *.lib 31 | 32 | # Executables 33 | *.exe 34 | *.out 35 | *.app 36 | 37 | # Eclipse 38 | .cproject 39 | .project 40 | .settings/ 41 | 42 | # Vscode 43 | .vscode/ 44 | 45 | # Python 46 | venv/ 47 | -------------------------------------------------------------------------------- /BuildWithMake/.gitignore: -------------------------------------------------------------------------------- 1 | svOneDSolver 2 | -------------------------------------------------------------------------------- /BuildWithMake/Makefile: -------------------------------------------------------------------------------- 1 | 2 | UNAME := $(shell uname) 3 | $(info UNAME="$(UNAME)") 4 | 5 | ifeq ($(UNAME),Darwin) 6 | include Makefile.darwin 7 | endif 8 | 9 | ifeq ($(UNAME),CYGWIN_NT-10.0) 10 | include Makefile.cygwin 11 | endif 12 | 13 | src=../Code/Source/*.cxx 14 | obj = $(src:.cpp=.o) 15 | 16 | # Set option to use Skyline solver 17 | flags=/DUSE_SKYLINE 18 | 19 | exe = svOneDSolver 20 | 21 | $(exe): $(obj) 22 | $(CXX) $(OPT_FLAGS) $(flags) -o $(exe) $(obj) $(libs) 23 | 24 | clean: 25 | rm *.obj *.exe 26 | 27 | -------------------------------------------------------------------------------- /BuildWithMake/Makefile.cygwin: -------------------------------------------------------------------------------- 1 | 2 | CLUSTER = x64_cygwin 3 | 4 | CXX=CL 5 | CC=CL 6 | 7 | CXXDEP = g++ -MM 8 | CCDEP = gcc -MM 9 | AR = lib -out: 10 | DEBUG_FLAGS = 11 | OPT_FLAGS = /nologo /MD /Ox /EHsc /MP /FS 12 | 13 | SHAR = "/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.10.25017/bin/HostX64/x64/link.exe" 14 | #SHAR = "/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/link.exe" 15 | SOEXT = dll 16 | STATICEXT = lib 17 | OBJECTEXT = obj 18 | BUILDFLAGS = $(GLOBAL_DEFINES) 19 | GLOBAL_CXXFLAGS = $(BUILDFLAGS) $(DEBUG_FLAGS) $(OPT_FLAGS) 20 | GLOBAL_CCFLAGS = $(BUILDFLAGS) $(DEBUG_FLAGS) $(OPT_FLAGS) 21 | GLOBAL_LFLAGS = /STACK:64000000,64000000 22 | SOLVER_STCKSZ = /STACK:512000000,512000000 23 | 24 | GLOBAL_LFLAGS += /LARGEADDRESSAWARE /INCREMENTAL:NO /FIXED:NO /RELEASE /NOLOGO \ 25 | /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcd.lib \ 26 | /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcpmt.lib \ 27 | /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:libcpmtd.lib \ 28 | /NODEFAULTLIB:msvcrtd.lib \ 29 | /MACHINE:X64 -subsystem:console 30 | # add verbose flag to debug linking issues (lists all search libraries) 31 | #GLOBAL_LFLAGS += /VERBOSE:LIB 32 | SHARED_LFLAGS = /DLL $(GLOBAL_LFLAGS) $(CXX_LIBS) 33 | STATIC_FLAG = 34 | DYNAMIC_FLAG = 35 | TEMPLATE_AR = $(AR) 36 | CC_LIBS = 37 | CXX_LIBS = Advapi32.lib Ws2_32.lib Shlwapi.lib 38 | LINK_EXE = $(SHAR) /out: 39 | LIBPATH_COMPILER_FLAG = /LIBPATH: 40 | LIBFLAG = 41 | LIBCMD = lib 42 | SVLIBFLAG =lib 43 | LIBLINKEXT =.lib 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /BuildWithMake/Makefile.darwin: -------------------------------------------------------------------------------- 1 | 2 | CC=g++ 3 | 4 | -------------------------------------------------------------------------------- /BuildWithMake/Release/developer_wrapper_scripts/developer-core-script: -------------------------------------------------------------------------------- 1 | #!/bin/bash -f 2 | 3 | # simvascular specific additions 4 | 5 | export SV_OS=REPLACEME_SV_OS 6 | export SOFTWARE_PLATFORM=REPLACEME_SOFTWARE_PLATFORM 7 | export CXX_COMPILER_VERSION=REPLACEME_CXX_COMPILER_VERSION 8 | export FORTRAN_COMPILER_VERSION=REPLACEME_FORTRAN_COMPILER_VERSION 9 | export LIB_BUILD_DIR=REPLACEME_LIB_BUILD_DIR 10 | export SV_VERSION=REPLACEME_SV_VERSION 11 | 12 | # must specify paths in unix style 13 | export OPEN_SOFTWARE_BINARIES_TOPLEVEL=REPLACEME_OPEN_SOFTWARE_BINARIES_TOPLEVEL 14 | export LICENSED_SOFTWARE_TOPLEVEL=REPLACEME_LICENSED_SOFTWARE_TOPLEVEL 15 | export SV_HOME=REPLACEME_SV_HOME 16 | 17 | #export SV_STATIC_BUILD=REPLACEME_SV_STATIC_BUILD 18 | 19 | ################################################################ 20 | # YOU PROBABLY DON'T NEED TO CHANGE ANYTHING BELOW THIS LINE. # 21 | ################################################################ 22 | 23 | # simvascular addition 24 | export LD_LIBRARY_PATH=$SV_HOME/BuildWithMake/Lib/$LIB_BUILD_DIR:$LD_LIBRARY_PATH 25 | 26 | # vtk additions 27 | case "$SV_OS" in 28 | "windows" ) 29 | export LD_LIBRARY_PATH=REPLACEME_VTK_SO_PATH:$LD_LIBRARY_PATH 30 | # leave VTK_RENDERER blank for win32 31 | ;; 32 | "linux" ) 33 | export LD_LIBRARY_PATH=REPLACEME_VTK_SO_PATH:$LD_LIBRARY_PATH 34 | export VTK_RENDERER=OpenGL 35 | ;; 36 | * ) 37 | export LD_LIBRARY_PATH=REPLACEME_VTK_SO_PATH:$LD_LIBRARY_PATH 38 | ;; 39 | esac 40 | 41 | # MPICH2 additions 42 | export LD_LIBRARY_PATH=REPLACEME_MPICH_SO_PATH:$LD_LIBRARY_PATH 43 | 44 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:REPLACEME_INTEL_COMPILER_SO_PATH 45 | 46 | # needed for macosx 47 | export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH 48 | 49 | # need to convert to dos style paths on windows 50 | case "$SV_OS" in 51 | "windows" ) 52 | export OPEN_SOFTWARE_BINARIES_TOPLEVEL=`cygpath --windows -t mixed $OPEN_SOFTWARE_BINARIES_TOPLEVEL` 53 | export SV_HOME=`cygpath --windows -t mixed $SV_HOME` 54 | export PATH=$LD_LIBRARY_PATH:$PATH 55 | ;; 56 | esac 57 | -------------------------------------------------------------------------------- /BuildWithMake/Release/developer_wrapper_scripts/developer-svpost-script: -------------------------------------------------------------------------------- 1 | 2 | # run the executable 3 | case "$*" in 4 | "") 5 | $SV_HOME/BuildWithMake/Bin/svpost.exe 6 | ;; 7 | *) 8 | $SV_HOME/BuildWithMake/Bin/svpost.exe $* 9 | ;; 10 | esac 11 | 12 | -------------------------------------------------------------------------------- /BuildWithMake/Release/developer_wrapper_scripts/developer-svpre-script: -------------------------------------------------------------------------------- 1 | 2 | # run the executable 3 | case "$*" in 4 | "") 5 | $SV_HOME/BuildWithMake/Bin/svpre.exe 6 | ;; 7 | *) 8 | $SV_HOME/BuildWithMake/Bin/svpre.exe $* 9 | ;; 10 | esac 11 | 12 | -------------------------------------------------------------------------------- /BuildWithMake/Release/developer_wrapper_scripts/developer-svsolver-mpi-linux-script: -------------------------------------------------------------------------------- 1 | #!/bin/bash -f 2 | 3 | # NOTE: in the past, needed to use tcsh to set unlimited 4 | # stack size. Using tcsh seems to die when using 5 | # ubuntu and mpich2 6 | # 7 | #/bin/tcsh -f 8 | # limit stacksize unlimited 9 | 10 | # simvascular specific additions 11 | 12 | export SOFTWARE_PLATFORM=REPLACEME_SOFTWARE_PLATFORM 13 | export COMPILER_VERSION=REPLACEME_COMPILER_VERSION 14 | export OPEN_SOFTWARE_BINARIES_TOPLEVEL=REPLACEME_OPEN_SOFTWARE_BINARIES_TOPLEVEL 15 | export LICENSED_SOFTWARE_TOPLEVEL=REPLACEME_LICENSED_SOFTWARE_TOPLEVEL 16 | export SV_HOME=REPLACEME_SV_HOME 17 | export LES_LICENSE_SERVER=REPLACEME_LES_LICENSE_SERVER 18 | 19 | ############################################################ 20 | # YOU SHOULDN'T NEED TO CHANGE ANYTHING BELOW THIS LINE!! # 21 | ############################################################ 22 | 23 | # 3-D solver environment variables 24 | export FLOWSOLVER_CONFIG=$SV_HOME/Code/FlowSolvers/ThreeDSolver/svSolver 25 | 26 | # simvascular addition 27 | export LD_LIBRARY_PATH=$SV_HOME/Code/Lib:$LD_LIBRARY_PATH 28 | 29 | # MPICH2 additions 30 | export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH 31 | 32 | # intel compiler additions 33 | export LD_LIBRARY_PATH=$OPEN_SOFTWARE_BINARIES_TOPLEVEL/intel_compiler_libs/intel64:$LD_LIBRARY_PATH 34 | 35 | $SV_HOME/BuildWithMake/Bin/svsolver-REPLACE_MPI_NAME.exe $* 36 | -------------------------------------------------------------------------------- /BuildWithMake/Release/developer_wrapper_scripts/developer-svsolver-mpi-macosx-script: -------------------------------------------------------------------------------- 1 | 2 | #!/bin/bash -f 3 | 4 | # NOTE: in the past, needed to use tcsh to set unlimited 5 | # stack size. Using tcsh seems to die when using 6 | # ubuntu and mpich2 7 | # 8 | #/bin/tcsh -f 9 | # limit stacksize unlimited 10 | 11 | # simvascular specific additions 12 | 13 | export SOFTWARE_PLATFORM=REPLACEME_SOFTWARE_PLATFORM 14 | export COMPILER_VERSION=REPLACEME_COMPILER_VERSION 15 | export OPEN_SOFTWARE_BINARIES_TOPLEVEL=REPLACEME_OPEN_SOFTWARE_BINARIES_TOPLEVEL 16 | export LICENSED_SOFTWARE_TOPLEVEL=REPLACEME_LICENSED_SOFTWARE_TOPLEVEL 17 | export SV_HOME=REPLACEME_SV_HOME 18 | export LES_LICENSE_SERVER=REPLACEME_LES_LICENSE_SERVER 19 | 20 | ############################################################ 21 | # YOU SHOULDN'T NEED TO CHANGE ANYTHING BELOW THIS LINE!! # 22 | ############################################################ 23 | 24 | # 3-D solver environment variables 25 | export FLOWSOLVER_CONFIG=$SV_HOME/Code/FlowSolvers/ThreeDSolver/svSolver 26 | 27 | # simvascular addition 28 | export LD_LIBRARY_PATH=$SV_HOME/Code/Lib:$LD_LIBRARY_PATH 29 | 30 | # MPICH2 additions 31 | export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH 32 | 33 | # intel compiler additions 34 | export LD_LIBRARY_PATH=$OPEN_SOFTWARE_BINARIES_TOPLEVEL/intel_compiler_libs/intel64:$LD_LIBRARY_PATH 35 | 36 | $SV_HOME/BuildWithMake/Bin/svsolver-REPLACE_MPI_NAME.exe $* 37 | -------------------------------------------------------------------------------- /BuildWithMake/Release/developer_wrapper_scripts/developer-svsolver-mpi-windows-script: -------------------------------------------------------------------------------- 1 | #!/bin/bash -f 2 | 3 | # simvascular specific additions 4 | 5 | export SOFTWARE_PLATFORM=REPLACEME_SOFTWARE_PLATFORM 6 | export COMPILER_VERSION=REPLACEME_COMPILER_VERSION 7 | export SV_OS=REPLACEME_SV_OS 8 | 9 | # must specify paths in unix style 10 | export OPEN_SOFTWARE_BINARIES_TOPLEVEL=REPLACEME_OPEN_SOFTWARE_BINARIES_TOPLEVEL 11 | export LICENSED_SOFTWARE_TOPLEVEL=REPLACEME_LICENSED_SOFTWARE_TOPLEVEL 12 | export SV_HOME=REPLACEME_SV_HOME 13 | 14 | # MeshSim license file 15 | export SIM_LICENSE_FILE=REPLACEME_LICENSE_FILE 16 | export SIM_LICENSE_FILE=$SV_HOME/Licenses/MeshSim/license.dat 17 | 18 | # 3-D solver environment variables 19 | export FLOWSOLVER_CONFIG=$SV_HOME/Code/FlowSolvers/ThreeDSolver/svSolver 20 | export LES_LICENSE_SERVER=$SV_HOME/Licenses/LesLib/license.dat 21 | #export LES_LICENSE_SERVER=foo.bar.edu 22 | 23 | ################################################################ 24 | # YOU PROBABLY DON'T NEED TO CHANGE ANYTHING BELOW THIS LINE. # 25 | # # 26 | # NOTE: This file needs to be kept current with changes in # 27 | # paths found in include.mk # 28 | # # 29 | ################################################################ 30 | 31 | # simvascular addition 32 | export LD_LIBRARY_PATH=$SV_HOME/Code/Lib:$LD_LIBRARY_PATH 33 | 34 | # need to convert to dos style paths on windows 35 | case "$SV_OS" in 36 | "windows" ) 37 | export SV_HOME=`cygpath --windows -t mixed $SV_HOME` 38 | export OPEN_SOFTWARE_BINARIES_TOPLEVEL=`cygpath --windows -t mixed $OPEN_SOFTWARE_BINARIES_TOPLEVEL` 39 | export LICENSED_SOFTWARE_TOPLEVEL=`cygpath --windows -t mixed $OPEN_SOFTWARE_BINARIES_TOPLEVEL` 40 | export FLOWSOLVER_CONFIG=`cygpath --windows -t mixed $FLOWSOLVER_CONFIG` 41 | export LES_LICENSE_SERVER=`cygpath --windows -t mixed $LES_LICENSE_SERVER` 42 | export PATH=$LD_LIBRARY_PATH:$PATH 43 | ;; 44 | esac 45 | 46 | # run the executable 47 | /cygdrive/c/Program\ Files/Microsoft\ MPI/Bin/mpiexec.exe -np $1 -env FLOWSOLVER_CONFIG $FLOWSOLVER_CONFIG $SV_HOME/BuildWithMake/Bin/svsolver-mpi.exe $2 $3 $4 48 | -------------------------------------------------------------------------------- /BuildWithMake/Release/developer_wrapper_scripts/developer-svsolver-nompi-linux-script: -------------------------------------------------------------------------------- 1 | #!/bin/bash -f 2 | 3 | # NOTE: in the past, needed to use tcsh to set unlimited 4 | # stack size. Using tcsh seems to die when using 5 | # ubuntu and mpich2 6 | # 7 | #/bin/tcsh -f 8 | # limit stacksize unlimited 9 | 10 | # simvascular specific additions 11 | 12 | export SOFTWARE_PLATFORM=REPLACEME_SOFTWARE_PLATFORM 13 | export COMPILER_VERSION=REPLACEME_COMPILER_VERSION 14 | export OPEN_SOFTWARE_BINARIES_TOPLEVEL=REPLACEME_OPEN_SOFTWARE_BINARIES_TOPLEVEL 15 | export LICENSED_SOFTWARE_TOPLEVEL=REPLACEME_LICENSED_SOFTWARE_TOPLEVEL 16 | export SV_HOME=REPLACEME_SV_HOME 17 | export LES_LICENSE_SERVER=REPLACEME_LES_LICENSE_SERVER 18 | 19 | ############################################################ 20 | # YOU SHOULDN'T NEED TO CHANGE ANYTHING BELOW THIS LINE!! # 21 | ############################################################ 22 | 23 | # 3-D solver environment variables 24 | export FLOWSOLVER_CONFIG=$SV_HOME/Code/FlowSolvers/ThreeDSolver/svSolver 25 | 26 | # simvascular addition 27 | export LD_LIBRARY_PATH=$SV_HOME/Code/Lib:$LD_LIBRARY_PATH 28 | 29 | # MPICH2 additions 30 | export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH 31 | 32 | # intel compiler additions 33 | export LD_LIBRARY_PATH=$OPEN_SOFTWARE_BINARIES_TOPLEVEL/intel_compiler_libs/intel64:$LD_LIBRARY_PATH 34 | 35 | $SV_HOME/BuildWithMake/Bin/svsolver-nompi.exe $* 36 | -------------------------------------------------------------------------------- /BuildWithMake/Release/developer_wrapper_scripts/developer-svsolver-nompi-macosx-script: -------------------------------------------------------------------------------- 1 | 2 | #!/bin/bash -f 3 | 4 | # NOTE: in the past, needed to use tcsh to set unlimited 5 | # stack size. Using tcsh seems to die when using 6 | # ubuntu and mpich2 7 | # 8 | #/bin/tcsh -f 9 | # limit stacksize unlimited 10 | 11 | # simvascular specific additions 12 | 13 | export SOFTWARE_PLATFORM=REPLACEME_SOFTWARE_PLATFORM 14 | export COMPILER_VERSION=REPLACEME_COMPILER_VERSION 15 | export OPEN_SOFTWARE_BINARIES_TOPLEVEL=REPLACEME_OPEN_SOFTWARE_BINARIES_TOPLEVEL 16 | export LICENSED_SOFTWARE_TOPLEVEL=REPLACEME_LICENSED_SOFTWARE_TOPLEVEL 17 | export SV_HOME=REPLACEME_SV_HOME 18 | export LES_LICENSE_SERVER=REPLACEME_LES_LICENSE_SERVER 19 | 20 | ############################################################ 21 | # YOU SHOULDN'T NEED TO CHANGE ANYTHING BELOW THIS LINE!! # 22 | ############################################################ 23 | 24 | # 3-D solver environment variables 25 | export FLOWSOLVER_CONFIG=$SV_HOME/Code/FlowSolvers/ThreeDSolver/svSolver 26 | 27 | # simvascular addition 28 | export LD_LIBRARY_PATH=$SV_HOME/Code/Lib:$LD_LIBRARY_PATH 29 | 30 | # MPICH2 additions 31 | export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH 32 | 33 | # intel compiler additions 34 | export LD_LIBRARY_PATH=$OPEN_SOFTWARE_BINARIES_TOPLEVEL/intel_compiler_libs/intel64:$LD_LIBRARY_PATH 35 | 36 | $SV_HOME/BuildWithMake/Bin/svsolver-nompi.exe $* 37 | -------------------------------------------------------------------------------- /BuildWithMake/Release/developer_wrapper_scripts/developer-svsolver-nompi-windows-script: -------------------------------------------------------------------------------- 1 | #!/bin/bash -f 2 | 3 | # simvascular specific additions 4 | 5 | export SOFTWARE_PLATFORM=REPLACEME_SOFTWARE_PLATFORM 6 | export COMPILER_VERSION=REPLACEME_COMPILER_VERSION 7 | export SV_OS=REPLACEME_SV_OS 8 | 9 | # must specify paths in unix style 10 | export OPEN_SOFTWARE_BINARIES_TOPLEVEL=REPLACEME_OPEN_SOFTWARE_BINARIES_TOPLEVEL 11 | export LICENSED_SOFTWARE_TOPLEVEL=REPLACEME_LICENSED_SOFTWARE_TOPLEVEL 12 | export SV_HOME=REPLACEME_SV_HOME 13 | 14 | # MeshSim license file 15 | export SIM_LICENSE_FILE=REPLACEME_LICENSE_FILE 16 | export SIM_LICENSE_FILE=$SV_HOME/Licenses/MeshSim/license.dat 17 | 18 | # 3-D solver environment variables 19 | export FLOWSOLVER_CONFIG=$SV_HOME/Code/FlowSolvers/ThreeDSolver/svSolver 20 | export LES_LICENSE_SERVER=$SV_HOME/Licenses/LesLib/license.dat 21 | #export LES_LICENSE_SERVER=foo.bar.edu 22 | 23 | ################################################################ 24 | # YOU PROBABLY DON'T NEED TO CHANGE ANYTHING BELOW THIS LINE. # 25 | # # 26 | # NOTE: This file needs to be kept current with changes in # 27 | # paths found in include.mk # 28 | # # 29 | ################################################################ 30 | 31 | # simvascular addition 32 | export LD_LIBRARY_PATH=$SV_HOME/Code/Lib:$LD_LIBRARY_PATH 33 | 34 | # need to convert to dos style paths on windows 35 | case "$SV_OS" in 36 | "windows" ) 37 | export SV_HOME=`cygpath --windows -t mixed $SV_HOME` 38 | export OPEN_SOFTWARE_BINARIES_TOPLEVEL=`cygpath --windows -t mixed $OPEN_SOFTWARE_BINARIES_TOPLEVEL` 39 | export LICENSED_SOFTWARE_TOPLEVEL=`cygpath --windows -t mixed $OPEN_SOFTWARE_BINARIES_TOPLEVEL` 40 | export FLOWSOLVER_CONFIG=`cygpath --windows -t mixed $FLOWSOLVER_CONFIG` 41 | export LES_LICENSE_SERVER=`cygpath --windows -t mixed $LES_LICENSE_SERVER` 42 | export PATH=$LD_LIBRARY_PATH:$PATH 43 | ;; 44 | esac 45 | 46 | # run the executable 47 | /cygdrive/c/Program\ Files/Microsoft\ MPI/Bin/mpiexec.exe -np $1 -env FLOWSOLVER_CONFIG $FLOWSOLVER_CONFIG $SV_HOME/BuildWithMake/Bin/svsolver-nompi.exe $2 $3 $4 48 | -------------------------------------------------------------------------------- /BuildWithMake/Release/linux_wrapper_scripts/linux-dist-core-script: -------------------------------------------------------------------------------- 1 | #!/bin/bash -f 2 | 3 | export SV_HOME=/usr/local/package/REPLACE_SV_VERSION/REPLACE_TIMESTAMP 4 | export SV_RELEASE_BUILD=REPLACE_SV_PLATFORM 5 | 6 | ################################################################ 7 | # YOU PROBABLY DON'T NEED TO CHANGE ANYTHING BELOW THIS LINE. # 8 | ################################################################ 9 | 10 | export SV_STATIC_BUILD=1 11 | export SV_RELEASED_MODE=1 12 | 13 | # SV additions (parasolid, tcltk, etc.) 14 | export LD_LIBRARY_PATH=$SV_HOME:$LD_LIBRARY_PATH 15 | 16 | # MPICH2 additions 17 | export LD_LIBRARY_PATH=$SV_HOME/mpi/lib:$LD_LIBRARY_PATH 18 | 19 | -------------------------------------------------------------------------------- /BuildWithMake/Release/linux_wrapper_scripts/linux-dist-svpost-script: -------------------------------------------------------------------------------- 1 | 2 | # run the executable 3 | case "$*" in 4 | "") 5 | $SV_HOME/postsolver-bin.exe 6 | ;; 7 | *) 8 | $SV_HOME/postsolver-bin.exe $* 9 | ;; 10 | esac 11 | 12 | 13 | -------------------------------------------------------------------------------- /BuildWithMake/Release/linux_wrapper_scripts/linux-dist-svpre-script: -------------------------------------------------------------------------------- 1 | 2 | $SV_HOME/presolver-bin.exe $* 3 | 4 | -------------------------------------------------------------------------------- /BuildWithMake/Release/linux_wrapper_scripts/linux-dist-svsolver-mpi-script: -------------------------------------------------------------------------------- 1 | 2 | # on windows, use a file 3 | #export LES_LICENSE_SERVER=$SV_HOME/Licenses/LesLib/license.dat 4 | # on linux, point to a server 5 | #export LES_LICENSE_SERVER=foo.bar.edu 6 | 7 | # config file for solver 8 | export FLOWSOLVER_CONFIG=$SV_HOME 9 | 10 | $SV_HOME/flowsolver-bin.exe $* 11 | -------------------------------------------------------------------------------- /BuildWithMake/Release/linux_wrapper_scripts/linux-dist-svsolver-nompi-script: -------------------------------------------------------------------------------- 1 | 2 | # on windows, use a file 3 | #export LES_LICENSE_SERVER=$SV_HOME/Licenses/LesLib/license.dat 4 | # on linux, point to a server 5 | #export LES_LICENSE_SERVER=foo.bar.edu 6 | 7 | # config file for solver 8 | export FLOWSOLVER_CONFIG=$SV_HOME 9 | 10 | $SV_HOME/flowsolver-bin.exe $* 11 | -------------------------------------------------------------------------------- /BuildWithMake/Release/platform_independent_scripts/generic-launch-script: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # the next line restarts using tclsh \ 3 | exec /usr/bin/tclsh "$0" $0 $* 4 | 5 | set lexec [lindex $argv 0] 6 | set myexec [file tail $lexec] 7 | set allvers [glob -nocomplain [file dirname $lexec]/../package/svsolver/*] 8 | set dirnames {} 9 | foreach i $allvers { 10 | if [file isdirectory $i] { 11 | lappend dirnames [file tail $i] 12 | } 13 | } 14 | if {[llength $dirnames] == 0} { 15 | return -code error "ERROR: installation of simvascular not found!" 16 | } 17 | 18 | set dirnames [lsort -integer $dirnames] 19 | set mostrecent [lindex $dirnames end] 20 | 21 | exec bash -c "[file dirname $lexec]/../package/svsolver/$mostrecent/$myexec [lrange $argv 1 end]" >&@ stdout 22 | 23 | exit 24 | -------------------------------------------------------------------------------- /BuildWithMake/Release/platform_independent_scripts/post-install.sh: -------------------------------------------------------------------------------- 1 | #/bin/sh 2 | rm -f /usr/local/bin/REPLACE_SV_VERSION 3 | rm -f /usr/local/bin/REPLACE_SV_VERSION-cmdline 4 | rm -f /usr/local/bin/adaptorREPLACE_SV_POSTFIX 5 | rm -f /usr/local/bin/tetadaptorREPLACE_SV_POSTFIX 6 | rm -f /usr/local/bin/presolverREPLACE_SV_POSTFIX 7 | rm -f /usr/local/bin/postsolverREPLACE_SV_POSTFIX 8 | rm -f /usr/local/bin/xfsvREPLACE_SV_POSTFIX 9 | cp /usr/local/package/REPLACE_SV_VERSION/REPLACE_TIMESTAMP/generic_launch_script /usr/local/bin/REPLACE_SV_VERSION 10 | cp /usr/local/package/REPLACE_SV_VERSION/REPLACE_TIMESTAMP/generic_launch_script /usr/local/bin/REPLACE_SV_VERSION-cmdline 11 | cp /usr/local/package/REPLACE_SV_VERSION/REPLACE_TIMESTAMP/generic_launch_script /usr/local/bin/adaptorREPLACE_SV_POSTFIX 12 | cp /usr/local/package/REPLACE_SV_VERSION/REPLACE_TIMESTAMP/generic_launch_script /usr/local/bin/tetadaptorREPLACE_SV_POSTFIX 13 | cp /usr/local/package/REPLACE_SV_VERSION/REPLACE_TIMESTAMP/generic_launch_script /usr/local/bin/presolverREPLACE_SV_POSTFIX 14 | cp /usr/local/package/REPLACE_SV_VERSION/REPLACE_TIMESTAMP/generic_launch_script /usr/local/bin/postsolverREPLACE_SV_POSTFIX 15 | cp /usr/local/package/REPLACE_SV_VERSION/REPLACE_TIMESTAMP/generic_launch_script /usr/local/bin/xfsvREPLACE_SV_POSTFIX 16 | chmod a+rx /usr/local/bin/simvascularREPLACE_SV_POSTFIX 17 | chmod a+rx /usr/local/bin/simvascularREPLACE_SV_POSTFIX-cmdline 18 | chmod a+rx /usr/local/bin/adaptorREPLACE_SV_POSTFIX 19 | chmod a+rx /usr/local/bin/tetadaptorREPLACE_SV_POSTFIX 20 | chmod a+rx /usr/local/bin/presolverREPLACE_SV_POSTFIX 21 | chmod a+rx /usr/local/bin/postsolverREPLACE_SV_POSTFIX 22 | chmod a+rx /usr/local/bin/xfsvREPLACE_SV_POSTFIX 23 | 24 | 25 | -------------------------------------------------------------------------------- /BuildWithMake/Release/platform_independent_scripts/post-solver-install.sh: -------------------------------------------------------------------------------- 1 | #/bin/sh 2 | rm -f /usr/local/bin/flowsolverREPLACE_SV_POSTFIX 3 | cp /usr/local/package/REPLACE_SV_VERSION/REPLACE_TIMESTAMP/generic_launch_script /usr/local/bin/flowsolverREPLACE_SV_POSTFIX 4 | chmod a+rx /usr/local/bin/flowsolverREPLACE_SV_POSTFIX 5 | 6 | 7 | -------------------------------------------------------------------------------- /BuildWithMake/Release/platform_independent_scripts/post-svsolver-install.sh: -------------------------------------------------------------------------------- 1 | #/bin/sh 2 | rm -f /usr/local/bin/svsolver-nompi 3 | cp /usr/local/package/REPLACE_SV_VERSION/REPLACE_TIMESTAMP/generic_launch_script /usr/local/bin/svsolver-nompi 4 | chmod a+rx /usr/local/bin/svsolver-nompi 5 | rm -f /usr/local/bin/svsolver-REPLACE_MPI_NAME 6 | cp /usr/local/package/REPLACE_SV_VERSION/REPLACE_TIMESTAMP/generic_launch_script /usr/local/bin/svsolver-REPLACE_MPI_NAME 7 | chmod a+rx /usr/local/bin/svsolver-REPLACE_MPI_NAME 8 | -------------------------------------------------------------------------------- /BuildWithMake/Release/tcl_helper_scripts/create_tclIndex.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014-2015 The Regents of the University of California. 3 | # All Rights Reserved. 4 | # 5 | # Portions of the code Copyright (c) 2009-2011 Open Source Medical 6 | # Software Corporation, University of California, San Diego. 7 | # All rights reserved. 8 | # 9 | # Copyright (c) 2007 Stanford University, 10 | # Charles Taylor, Nathan Wilson, Bill Katz. 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining 13 | # a copy of this software and associated documentation files (the 14 | # "Software"), to deal in the Software without restriction, including 15 | # without limitation the rights to use, copy, modify, merge, publish, 16 | # distribute, sublicense, and/or sell copies of the Software, and to 17 | # permit persons to whom the Software is furnished to do so, subject 18 | # to the following conditions: 19 | # 20 | # The above copyright notice and this permission notice shall be included 21 | # in all copies or substantial portions of the Software. 22 | # 23 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 24 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 26 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 27 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 28 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 29 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 30 | 31 | proc check_for_dirs {mydir} { 32 | foreach fn [glob -nocomplain [file join $mydir *]] { 33 | puts "$fn" 34 | if [file isdirectory $fn] { 35 | puts "found directory $fn" 36 | if {[llength [glob -nocomplain [file join $fn *.tcl]]] > 0} { 37 | puts "indexing $fn *.tcl" 38 | catch {auto_mkindex $fn *.tcl} 39 | } 40 | check_for_dirs $fn 41 | } 42 | } 43 | puts "Finished check for dirs" 44 | } 45 | 46 | check_for_dirs $argv 47 | -------------------------------------------------------------------------------- /BuildWithMake/Release/tcl_helper_scripts/d2u_files.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014-2015 The Regents of the University of California. 3 | # All Rights Reserved. 4 | # 5 | # Portions of the code Copyright (c) 2009-2011 Open Source Medical 6 | # Software Corporation, University of California, San Diego. 7 | # All rights reserved. 8 | # 9 | # Permission is hereby granted, free of charge, to any person obtaining 10 | # a copy of this software and associated documentation files (the 11 | # "Software"), to deal in the Software without restriction, including 12 | # without limitation the rights to use, copy, modify, merge, publish, 13 | # distribute, sublicense, and/or sell copies of the Software, and to 14 | # permit persons to whom the Software is furnished to do so, subject 15 | # to the following conditions: 16 | # 17 | # The above copyright notice and this permission notice shall be included 18 | # in all copies or substantial portions of the Software. 19 | # 20 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 21 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 23 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 24 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 25 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 26 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | # 28 | 29 | foreach fileext {.cxx .c .h .tcl .txt .f Makefile ACKNOWLEDGEMENTS .mk} { 30 | 31 | foreach i [file_find .. *$fileext] { 32 | 33 | if {![file isdirectory $i]} { 34 | 35 | if {[regexp .svn $i]} { 36 | 37 | puts "Skipping svn hidden file ($i)." 38 | 39 | } else { 40 | 41 | file_dos2unix $i $i.tmp 42 | if [catch {exec diff $i $i.tmp} msg] { 43 | puts "File $i has changed after d2u!!" 44 | } 45 | file delete $i 46 | file rename $i.tmp $i 47 | 48 | } 49 | 50 | } else { 51 | 52 | puts "skipping directory $i" 53 | 54 | } 55 | 56 | } 57 | 58 | } 59 | 60 | -------------------------------------------------------------------------------- /BuildWithMake/Release/windows_installer_packages/.wix-simvascular-svsolver-bundle.wxs.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimVascular/svOneDSolver/66b31b4221b8dc9c04a767ed48e6a5367f63a499/BuildWithMake/Release/windows_installer_packages/.wix-simvascular-svsolver-bundle.wxs.swp -------------------------------------------------------------------------------- /BuildWithMake/Release/windows_installer_packages/msi-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimVascular/svOneDSolver/66b31b4221b8dc9c04a767ed48e6a5367f63a499/BuildWithMake/Release/windows_installer_packages/msi-logo.png -------------------------------------------------------------------------------- /BuildWithMake/Release/windows_installer_packages/wix-simvascular-svonedsolver-bundle.wxs: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /BuildWithMake/Release/windows_installer_packages/wix-simvascular-svonedsolver-bundle.wxs~: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /BuildWithMake/Release/windows_msi_helpers/msi-banner.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimVascular/svOneDSolver/66b31b4221b8dc9c04a767ed48e6a5367f63a499/BuildWithMake/Release/windows_msi_helpers/msi-banner.bmp -------------------------------------------------------------------------------- /BuildWithMake/Release/windows_msi_helpers/msi-banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimVascular/svOneDSolver/66b31b4221b8dc9c04a767ed48e6a5367f63a499/BuildWithMake/Release/windows_msi_helpers/msi-banner.jpg -------------------------------------------------------------------------------- /BuildWithMake/Release/windows_msi_helpers/msi-dialog.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimVascular/svOneDSolver/66b31b4221b8dc9c04a767ed48e6a5367f63a499/BuildWithMake/Release/windows_msi_helpers/msi-dialog.bmp -------------------------------------------------------------------------------- /BuildWithMake/Release/windows_msi_helpers/msi-dialog.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimVascular/svOneDSolver/66b31b4221b8dc9c04a767ed48e6a5367f63a499/BuildWithMake/Release/windows_msi_helpers/msi-dialog.jpg -------------------------------------------------------------------------------- /BuildWithMake/Release/windows_msi_helpers/simvascular.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimVascular/svOneDSolver/66b31b4221b8dc9c04a767ed48e6a5367f63a499/BuildWithMake/Release/windows_msi_helpers/simvascular.ico -------------------------------------------------------------------------------- /BuildWithMake/Release/windows_msi_helpers/uuidgen.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014-2015 The Regents of the University of California. 2 | * All Rights Reserved. 3 | * 4 | * Portions of the code Copyright (c) 2009-2011 Open Source Medical 5 | * Software Corporation, University of California, San Diego. 6 | * All rights reserved. 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 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 20 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #define _OLEAUT32_ 29 | 30 | #include 31 | #include 32 | 33 | GUID guid; 34 | WORD* wstrGUID[100]; 35 | char strGUID[100]; 36 | int count, i; 37 | 38 | int main (int argc, char* argv[]) { 39 | if (argc != 2) { 40 | fprintf (stderr, "SYNTAX: UUIDGEN \n"); 41 | return 1; 42 | } 43 | count = atoi (argv[1]); 44 | for (i = 0; i < count; i++) { 45 | CoCreateGuid (&guid); 46 | StringFromCLSID (&guid, wstrGUID); 47 | WideCharToMultiByte (CP_ACP, 0, *wstrGUID, -1, strGUID, MAX_PATH, NULL, NULL); 48 | printf ("%s\n", strGUID); 49 | } 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /BuildWithMake/Release/windows_wrapper_scripts/windows-dist-core-script: -------------------------------------------------------------------------------- 1 | #!/bin/bash -f 2 | 3 | export SV_HOME=/usr/local/package/svsolver/REPLACE_TIMESTAMP 4 | export SV_RELEASE_BUILD=REPLACE_SV_PLATFORM 5 | export SV_OS=REPLACE_SV_OS 6 | 7 | ################################################################ 8 | # YOU PROBABLY DON'T NEED TO CHANGE ANYTHING BELOW THIS LINE. # 9 | ################################################################ 10 | 11 | export SV_STATIC_BUILD=1 12 | export SV_RELEASED_MODE=1 13 | 14 | # SV additions (parasolid, tcltk, etc.) 15 | export LD_LIBRARY_PATH=$SV_HOME:$LD_LIBRARY_PATH 16 | 17 | # MPICH2 additions 18 | export LD_LIBRARY_PATH=$SV_HOME/mpi/lib:$LD_LIBRARY_PATH 19 | 20 | # intel additions 21 | export LD_LIBRARY_PATH=$SV_HOME/intel_compiler_libs:$LD_LIBRARY_PATH 22 | 23 | # need to convert to dos style paths on windows 24 | case "$SV_OS" in 25 | "windows" ) 26 | export SV_HOME=`cygpath --windows -t mixed "$SV_HOME"` 27 | export PATH=$LD_LIBRARY_PATH:$PATH 28 | ;; 29 | esac 30 | -------------------------------------------------------------------------------- /BuildWithMake/Release/windows_wrapper_scripts/windows-dist-svpost-script: -------------------------------------------------------------------------------- 1 | 2 | # run the executable 3 | case "$*" in 4 | "") 5 | "$SV_HOME/svpost-bin.exe" 6 | ;; 7 | *) 8 | "$SV_HOME/svpost-bin.exe" $* 9 | ;; 10 | esac 11 | -------------------------------------------------------------------------------- /BuildWithMake/Release/windows_wrapper_scripts/windows-dist-svpre-script: -------------------------------------------------------------------------------- 1 | 2 | $SV_HOME/svpre-bin.exe $* 3 | 4 | -------------------------------------------------------------------------------- /BuildWithMake/Release/windows_wrapper_scripts/windows-dist-svsolver-mpi-script: -------------------------------------------------------------------------------- 1 | 2 | # 3-D solver environment variables 3 | export FLOWSOLVER_CONFIG=$SV_HOME 4 | 5 | #export LES_LICENSE_SERVER=$SV_HOME/license.dat 6 | 7 | $SV_HOME/mpiexec.exe -noprompt -user 1 -localroot -localonly -env FLOWSOLVER_CONFIG $FLOWSOLVER_CONFIG -n $1 $SV_HOME/svsolver-REPLACE_MPI_NAME-bin.exe $2 $3 8 | -------------------------------------------------------------------------------- /BuildWithMake/Release/windows_wrapper_scripts/windows-dist-svsolver-nompi-script: -------------------------------------------------------------------------------- 1 | 2 | # 3-D solver environment variables 3 | export FLOWSOLVER_CONFIG=$SV_HOME 4 | 5 | #export LES_LICENSE_SERVER=$SV_HOME/license.dat 6 | 7 | $SV_HOME/mpiexec.exe -noprompt -user 1 -localroot -localonly -env FLOWSOLVER_CONFIG $FLOWSOLVER_CONFIG -n $1 $SV_HOME/svsolver-nompi-bin.exe $2 $3 8 | -------------------------------------------------------------------------------- /BuildWithMake/build_windows_github.bat: -------------------------------------------------------------------------------- 1 | REM This file is used to setup the environment variables and start the build in 2 | REM the GitHub Workflow 3 | 4 | REM Call vcvars64.bat to setup environment variables like CL 5 | call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat" 6 | 7 | REM Build SimVascular 8 | sh ./windows-build.sh 9 | 10 | REM Make release executable BuildWithMake/SimVascular-VERSION-Windows-64bit-bundle.exe 11 | cd Release 12 | make 13 | -------------------------------------------------------------------------------- /BuildWithMake/windows-build.sh: -------------------------------------------------------------------------------- 1 | 2 | if hash CL 2>/dev/null; then 3 | clfullpath=`which CL` 4 | clparentdir="$(dirname "$clfullpath")" 5 | export PATH=$clparentdir::$PATH 6 | fi 7 | 8 | if hash vsstrace.exe 2>/dev/null; then 9 | rcfullpath=`which vsstrace.exe` 10 | rcparentdir="$(dirname "$rcfullpath")" 11 | export PATH=$rcparentdir:$PATH 12 | fi 13 | 14 | make 15 | 16 | -------------------------------------------------------------------------------- /BuildWithMake/wix-3.11.x64_cygwin.mk: -------------------------------------------------------------------------------- 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. 30 | 31 | WIXUI_PATH := /cygdrive/c/Program\ Files\ \(x86\)/WiX\ Toolset\ v3.11/bin 32 | WIXUI_WIN_PATH := C:/Program\ Files\ \(x86\)/WiX\ Toolset\ v3.11/bin 33 | -------------------------------------------------------------------------------- /Code/Source/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # COMPILE CODE IN SPARSE SUBDIRECTORY 3 | IF(sparseSolverType STREQUAL "skyline") 4 | 5 | # JUST ADD THE SOURCE FILES 6 | ADD_EXECUTABLE(${PROJECT_NAME} ${SRC_C} ${SRC_H}) 7 | 8 | ELSEIF(sparseSolverType STREQUAL "superlu") 9 | 10 | # FIND BLAS 11 | FIND_PACKAGE(BLAS REQUIRED) 12 | IF(BLAS_FOUND) 13 | INCLUDE_DIRECTORIES(${BLAS_INCLUDE_DIRS}) 14 | ENDIF() 15 | 16 | # CHECK IF SUPERLU_DIR IS STILL UNDEFINED 17 | IF(${SUPERLU_DIR} STREQUAL " ") 18 | MESSAGE(FATAL_ERROR "The SUPERLU_DIR folder is undefined.\ 19 | Please enter the path to the superLU_MT library.") 20 | ENDIF() 21 | 22 | # CHECK IF SUPERLU_DIR EXISTS 23 | IF(EXISTS ${SUPERLU_DIR}) 24 | 25 | SET(SUPERLU_INCLUDE_DIRS "${SUPERLU_DIR}/SRC") 26 | SET(SUPERLU_LIBRARY "${SUPERLU_DIR}/lib/libsuperlu_mt_PTHREAD.a") 27 | 28 | MESSAGE(STATUS "SuperLU Includes: ${SUPERLU_INCLUDE_DIRS}") 29 | MESSAGE(STATUS "SuperLU Library: ${SUPERLU_LIBRARY}") 30 | 31 | ELSE() 32 | MESSAGE(FATAL_ERROR "The SUPERLU_DIR folder is invalid.\ 33 | Please enter the path to the superLU_MT library.") 34 | ENDIF() 35 | 36 | # ADD FILES IN ADDITIONAL FOLDERS 37 | FILE(GLOB SUPERLU_SRC_C "${CMAKE_SOURCE_DIR}/src/sparse/*.c" 38 | "${CMAKE_SOURCE_DIR}/src/sparse/*.cpp" 39 | "${CMAKE_SOURCE_DIR}/src/sparse/superlu/*.c" 40 | "${CMAKE_SOURCE_DIR}/src/sparse/superlu/*.cpp") 41 | FILE(GLOB SUPERLU_SRC_H "${CMAKE_SOURCE_DIR}/src/sparse/*.h" 42 | "${CMAKE_SOURCE_DIR}/src/sparse/superlu/*.h" 43 | "${SUPERLU_INCLUDE_DIRS}/slu_mt_ddefs.h") 44 | 45 | # INCLUDE DIRECTORIES 46 | INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src 47 | ${CMAKE_SOURCE_DIR}/src/sparse 48 | ${CMAKE_SOURCE_DIR}/src/sparse/superlu 49 | ${SUPERLU_INCLUDE_DIRS}) 50 | 51 | # LINK DIRECTORIES 52 | LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/src 53 | ${CMAKE_SOURCE_DIR}/src/sparse 54 | ${CMAKE_SOURCE_DIR}/src/sparse/superlu) 55 | 56 | ADD_EXECUTABLE(${PROJECT_NAME} ${SRC_C} ${SRC_H} ${SUPERLU_SRC_C} ${SUPERLU_SRC_H}) 57 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${BLAS_LIBRARIES} ${SUPERLU_LIBRARY} pthread) 58 | 59 | ELSEIF(sparseSolverType STREQUAL "csparse") 60 | 61 | # ADD FILES IN ADDITIONAL FOLDERS 62 | FILE(GLOB CSPARSE_SRC_C "${CMAKE_SOURCE_DIR}/src/sparse/*.c" 63 | "${CMAKE_SOURCE_DIR}/src/sparse/*.cpp" 64 | "${CMAKE_SOURCE_DIR}/src/sparse/csparse/*.c" 65 | "${CMAKE_SOURCE_DIR}/src/sparse/csparse/*.cpp") 66 | FILE(GLOB CSPARSE_SRC_H "${CMAKE_SOURCE_DIR}/src/sparse/*.h" 67 | "${CMAKE_SOURCE_DIR}/src/sparse/csparse/*.h") 68 | 69 | # INCLUDE DIRECTORIES 70 | INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src 71 | ${CMAKE_SOURCE_DIR}/src/sparse 72 | ${CMAKE_SOURCE_DIR}/src/sparse/csparse) 73 | 74 | # LINK DIRECTORIES 75 | LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/src 76 | ${CMAKE_SOURCE_DIR}/src/sparse 77 | ${CMAKE_SOURCE_DIR}/src/sparse/csparse) 78 | 79 | # ADD SOURCE ON SPARSE FOLDER 80 | ADD_EXECUTABLE(${PROJECT_NAME} ${SRC_C} ${SRC_H} ${CSPARSE_SRC_C} ${CSPARSE_SRC_H}) 81 | 82 | ENDIF() 83 | 84 | install( TARGETS ${PROJECT_NAME} 85 | RUNTIME 86 | DESTINATION bin 87 | COMPONENT executable ) 88 | 89 | -------------------------------------------------------------------------------- /Code/Source/cvOneDComplex.cxx: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | /*************************************************************************** 33 | * Complex.C * 34 | * * 35 | * Complex numbers, complex arithmetic, and functions of a complex * 36 | * variable. * 37 | * * 38 | ***************************************************************************/ 39 | #include "cvOneDComplex.h" 40 | 41 | const cvOneDComplex cvOneDComplex::i(0.0,1.0); 42 | 43 | cvOneDComplex cos(const cvOneDComplex &z){ 44 | return cvOneDComplex(cos(z.Real()) * cosh(z.Imag()), -sin(z.Real()) * sinh(z.Imag())); 45 | } 46 | 47 | cvOneDComplex sin(const cvOneDComplex &z){ 48 | return cvOneDComplex(sin( z.Real() ) * cosh( z.Imag() ), cos( z.Real() ) * sinh( z.Imag())); 49 | } 50 | 51 | cvOneDComplex cosh(const cvOneDComplex &z){ 52 | return cvOneDComplex(cosh( z.Real() ) * cos( z.Imag() ),sinh( z.Real() ) * sin( z.Imag())); 53 | } 54 | 55 | cvOneDComplex sinh(const cvOneDComplex &z){ 56 | return cvOneDComplex(sinh( z.Real() ) * cos( z.Imag() ),cosh( z.Real() ) * sin( z.Imag())); 57 | } 58 | 59 | cvOneDComplex log(const cvOneDComplex &z){ 60 | double r = sqrt( z.Real() * z.Real() + z.Imag() * z.Imag() ); 61 | double t = acos( z.Real() / r ); 62 | if( z.Imag() < 0.0 ) t = 2.0 * 3.1415926 - t; 63 | return cvOneDComplex( log(r), t ); 64 | } 65 | 66 | -------------------------------------------------------------------------------- /Code/Source/cvOneDDataTable.cxx: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #include "cvOneDDataTable.h" 33 | 34 | // Constructor 35 | cvOneDDataTable::cvOneDDataTable(){ 36 | } 37 | // Destructor 38 | cvOneDDataTable::~cvOneDDataTable(){ 39 | } 40 | 41 | void cvOneDDataTable::setName(string name){ 42 | this->name = name; 43 | } 44 | 45 | void cvOneDDataTable::setType(string type){ 46 | this->type = type; 47 | } 48 | 49 | void cvOneDDataTable::setTime(cvDoubleVec time){ 50 | this->time.clear(); 51 | for(int loopA=0;loopAtime.push_back(time[loopA]); 53 | } 54 | } 55 | 56 | void cvOneDDataTable::setValues(cvDoubleVec values){ 57 | this->values.clear(); 58 | for(int loopA=0;loopAvalues.push_back(values[loopA]); 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /Code/Source/cvOneDDataTable.h: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #ifndef CVONEDDATATABLE_H 33 | #define CVONEDDATATABLE_H 34 | 35 | # include 36 | # include "cvOneDTypes.h" 37 | 38 | using namespace std; 39 | 40 | class cvOneDDataTable{ 41 | protected: 42 | string name; 43 | string type; 44 | cvDoubleVec time; 45 | cvDoubleVec values; 46 | 47 | public: 48 | cvOneDDataTable(); 49 | virtual ~cvOneDDataTable(); 50 | 51 | // Getters and Setters 52 | string getName(){return this->name;} 53 | string getType(){return this->type;} 54 | double getTime(int index){return this->time[index];} 55 | double getValues(int index){return this->values[index];} 56 | int getSize(){return this->values.size();} 57 | 58 | void setName(string name); 59 | void setType(string type); 60 | void setTime(cvDoubleVec time); 61 | void setValues(cvDoubleVec values); 62 | 63 | }; 64 | 65 | #endif // CVONEDDATATABLE_H 66 | 67 | -------------------------------------------------------------------------------- /Code/Source/cvOneDDenseMatrix.cxx: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | // 33 | // DenseMatrix.cxx - Source for a class to handle dense matrices 34 | // ~~~~~~~~~~~~~~~ 35 | // 36 | // This class creates an n x n dense matrix 37 | // for use in finite element calculations. 38 | // Typically, this will be used to store local 39 | // (element) matrices before they are assembled 40 | // into the global Jacobian. 41 | // 42 | 43 | #include 44 | #include 45 | 46 | #include "cvOneDDenseMatrix.h" 47 | 48 | void cvOneDDenseMatrix::CreateMatrix(long dim, const char* tit){ 49 | long i; 50 | 51 | assert( dim > 0); 52 | dimension = dim; 53 | 54 | equationNumbers = new long[dimension]; 55 | entries = new double[dimension * dimension]; 56 | assert( equationNumbers != 0 && entries != 0); 57 | 58 | i = 0; 59 | while(i < MAX_STRING_SIZE && tit[i] != '\0'){ 60 | title[i] = tit[i]; 61 | i++; 62 | } 63 | title[i] = '\0'; 64 | } 65 | 66 | cvOneDDenseMatrix::cvOneDDenseMatrix(long dim, const char* tit){ 67 | CreateMatrix(dim,tit); 68 | } 69 | 70 | cvOneDDenseMatrix::cvOneDDenseMatrix(long dim, long* eqNumbers, const char* tit){ 71 | CreateMatrix(dim,tit); 72 | SetEquationNumbers(eqNumbers); 73 | } 74 | 75 | void cvOneDDenseMatrix::SetEquationNumbers(long* eqNumbers){ 76 | for(long i = 0; i < dimension; i++){ 77 | equationNumbers[i] = eqNumbers[i]; 78 | } 79 | } 80 | 81 | cvOneDDenseMatrix::~cvOneDDenseMatrix(){ 82 | delete [] equationNumbers; 83 | delete [] entries; 84 | } 85 | 86 | void cvOneDDenseMatrix::Clear(){ 87 | double* ptr = entries; 88 | for( long i = 0; i < dimension*dimension; i++){ 89 | *ptr++ = 0.0; 90 | } 91 | } 92 | 93 | void cvOneDDenseMatrix::Set(long row, long column, double value){ 94 | assert( row >= 0 && column < dimension); 95 | entries[ row * dimension + column] = value; 96 | } 97 | 98 | void cvOneDDenseMatrix::Add(long row, long column, double value){ 99 | assert( row >= 0 && column < dimension); 100 | entries[ row * dimension + column] += value; 101 | } 102 | -------------------------------------------------------------------------------- /Code/Source/cvOneDDenseMatrix.h: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #ifndef CVONEDDENSEMATRIXX_H 33 | #define CVONEDDENSEMATRIXX_H 34 | 35 | // 36 | // cvOneDDenseMatrix.h - Header for a class to handle dense matrices 37 | // ~~~~~~~~~~~~~~~ 38 | // 39 | // SYNOPSIS...This class creates an n x n dense matrix 40 | // for use in finite element calculations. 41 | // Typically, this will be used to store local 42 | // (element) matrices before they are assembled 43 | // into the global Jacobian. 44 | 45 | # include 46 | # include 47 | 48 | # include "cvOneDSolverDefinitions.h" 49 | 50 | using namespace std; 51 | 52 | class cvOneDDenseMatrix{ 53 | 54 | public: 55 | 56 | cvOneDDenseMatrix( long dim, const char* tit = "matrix"); 57 | cvOneDDenseMatrix( long dim, long* eqNumbers, const char* tit = "matrix"); 58 | virtual ~cvOneDDenseMatrix(); 59 | void SetEquationNumbers( long* eqNumbers); 60 | void Clear(); 61 | long GetDimension() const {return dimension;} 62 | long* GetEquationNumbers(){return equationNumbers;} 63 | double* GetPointerToEntries() {return entries;} 64 | void Set( long row, long column, double value); 65 | void Add( long row, long column, double value); 66 | 67 | private: 68 | 69 | void CreateMatrix( long dim, const char* tit = "matrix"); 70 | 71 | long dimension; 72 | long* equationNumbers; 73 | double* entries; 74 | char title[MAX_STRING_SIZE + 1]; 75 | 76 | }; 77 | 78 | #endif // CVONEDDENSEMATRIXX_H 79 | -------------------------------------------------------------------------------- /Code/Source/cvOneDError.cxx: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | // 33 | // Error.cxx: Source file for cvOneDError.handling/Debugging 34 | // ~~~~~~~~~ 35 | // 36 | 37 | #include "cvOneDError.h" 38 | 39 | using namespace std; 40 | 41 | // Declare the static globals 42 | ErrorType cvOneDError::ErrorNo; 43 | char* cvOneDError::ErrorString; 44 | ErrorHandlerFunctionPtr cvOneDError::errorHandler; 45 | int cvOneDError::debugLevel; 46 | 47 | // Functions to be used by applications 48 | ErrorType cvOneDError::getErrorNumber(void){ 49 | return ErrorNo; 50 | } 51 | 52 | char* cvOneDError::getErrorString(void){ 53 | return ErrorString; 54 | } 55 | 56 | ErrorHandlerFunctionPtr cvOneDError::setErrorHandler(ErrorHandlerFunctionPtr fcn){ 57 | errorHandler = fcn; 58 | return errorHandler; 59 | } 60 | 61 | void cvOneDError::setDebugLevel(int level){ 62 | debugLevel = level; 63 | } 64 | 65 | int cvOneDError::getDebugLevel(void){ 66 | return debugLevel; 67 | } 68 | 69 | // Functions to be used by API 70 | void cvOneDError::setErrorNumber(ErrorType errorNumber){ 71 | ErrorNo = errorNumber; 72 | } 73 | 74 | void cvOneDError::setErrorString(char *string){ 75 | ErrorString = string; 76 | } 77 | 78 | void cvOneDError::CallErrorHandler(void){ 79 | if(errorHandler == NULL){ 80 | cerr << "There's an error, but No error handler!" << endl; 81 | return; 82 | } 83 | errorHandler(); 84 | } 85 | -------------------------------------------------------------------------------- /Code/Source/cvOneDError.h: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #ifndef CVONEDERROR_H 33 | #define CVONEDERROR_H 34 | 35 | // 36 | // cvOneDError.h: Header file for cvOneDError.handling/Debugging 37 | // ~~~~~~~~~ 38 | // 39 | // NOTES: 40 | // 41 | // If you want to use this class to handle errors in your code 42 | // (and you should becase it provides a consistant way to do 43 | // this throughout the code and any applications derived from it), 44 | // Simply set the appropriate Error Number with setErrorNumber(...) 45 | // and a *descriptive* error string using setErrorString(...) 46 | // If you want to handle the error yourself (ie. you don't think 47 | // the application programmer should have to do this explicitly, 48 | // such as a max iterations exceeded, etc...), call the error 49 | // handler -- which will be defined by the programmer in his/her 50 | // code. 51 | // 52 | 53 | #include "cvOneDEnums.h" 54 | 55 | typedef void (*ErrorHandlerFunctionPtr)(); 56 | 57 | class cvOneDError{ 58 | public: // these are used by applications 59 | static ErrorType getErrorNumber(void); 60 | static char* getErrorString(void); 61 | 62 | static ErrorHandlerFunctionPtr setErrorHandler(ErrorHandlerFunctionPtr fcn); 63 | 64 | static void setDebugLevel(int level); 65 | static int getDebugLevel(void); 66 | 67 | public: // these should be used predominantly by API 68 | 69 | static void setErrorNumber(ErrorType errorNumber); 70 | static void setErrorString(char *string); 71 | static void CallErrorHandler(void); 72 | 73 | private: 74 | 75 | cvOneDError(void); // prohibit instancing 76 | 77 | // error handling state info 78 | static ErrorType ErrorNo; 79 | static char* ErrorString; 80 | static ErrorHandlerFunctionPtr errorHandler; 81 | 82 | // debugging state info 83 | static int debugLevel; 84 | }; 85 | 86 | #endif // CVONEDERROR_H 87 | -------------------------------------------------------------------------------- /Code/Source/cvOneDException.cxx: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #include "cvOneDException.h" 33 | 34 | -------------------------------------------------------------------------------- /Code/Source/cvOneDException.h: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #ifndef CVONEDEXCEPTION_H 33 | #define CVONEDEXCEPTION_H 34 | 35 | #include 36 | 37 | using namespace std; 38 | 39 | class cvException: public exception{ 40 | public: 41 | // Constructor and Destructor 42 | cvException(const char* m):msg(m){} 43 | virtual ~cvException() throw(){} 44 | // Member Functions 45 | virtual const char* what() const throw() {return msg.c_str();} 46 | protected: 47 | string msg; 48 | }; 49 | 50 | #endif // CVONEDEXCEPTION_H 51 | 52 | -------------------------------------------------------------------------------- /Code/Source/cvOneDFEAJoint.h: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #ifndef CVONEDFEAJOINT_H 33 | #define CVONEDFEAJOINT_H 34 | 35 | // cvOneDFEAJoint.h: A data structure for Lagrange joints. 36 | // ~~~~~~~~~~ 37 | // 38 | 39 | # include 40 | 41 | # include "cvOneDSubdomain.h" 42 | 43 | using namespace std; 44 | 45 | class cvOneDFEAJoint{ 46 | public: 47 | cvOneDFEAJoint() {;} 48 | ~cvOneDFEAJoint(){;} 49 | void setJointID(int i){id = i;} 50 | // total number of segments 51 | int getNumberOfSegments(){return InletSubdomains.size()+OutletSubdomains.size();} 52 | // inlet segments 53 | int getNumberOfInletSegments(){return InletSubdomains.size();} 54 | // outlet segments 55 | int getNumberOfOutletSegments(){return OutletSubdomains.size();} 56 | // add an inlet segment by its global segment index 57 | void AddInletSubdomains(int i){InletSubdomains.push_back(i);} 58 | // add an inlet segment by its global segment index 59 | void AddOutletSubdomains(int i){OutletSubdomains.push_back(i);} 60 | // get the global segment index of ith inlet segment 61 | int GetInletID(int ith){return InletSubdomains[ith];} 62 | // get the global segment index of ith outlet segment 63 | int GetOutletID(int ith){return OutletSubdomains[ith];} 64 | long GetGlobal1stLagNodeID(void){return global1stLagNodeID;} 65 | void SetGlobal1stLagNodeID(long ID){global1stLagNodeID = ID;} 66 | private: 67 | long global1stLagNodeID; 68 | int id; 69 | vector InletSubdomains; 70 | vector OutletSubdomains; 71 | }; 72 | 73 | #endif // CVONEDFEAJOINT_H 74 | -------------------------------------------------------------------------------- /Code/Source/cvOneDFEAMatrix.cxx: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | // 33 | // SkylineMatrix.cxx - Solve Skyline Matrices 34 | // 35 | 36 | # include 37 | # include 38 | # include "cvOneDSkylineMatrix.h" 39 | # include "cvOneDDenseMatrix.h" 40 | 41 | using namespace std; 42 | 43 | cvOneDFEAMatrix::cvOneDFEAMatrix(const char* tit){ 44 | int i = 0; 45 | while( i < MAX_STRING_SIZE && tit[i] != '\0'){ 46 | title[i] = tit[i]; 47 | i++; 48 | } 49 | title[i] = '\0'; 50 | } 51 | 52 | cvOneDFEAMatrix::~cvOneDFEAMatrix(){ 53 | } 54 | 55 | 56 | -------------------------------------------------------------------------------- /Code/Source/cvOneDFEAMatrix.h: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #ifndef CVONEDFEAMATRIX_H 33 | #define CVONEDFEAMATRIX_H 34 | 35 | // 36 | // cvOneDSkylineMatrix.h - Solve Skyline Matrices 37 | // ~~~~~~~~~~~~~~~~~ 38 | // matrix storage for direct solver, skyline solver 39 | // 40 | 41 | #include 42 | #include "cvOneDSolverDefinitions.h" 43 | #include "cvOneDDenseMatrix.h" 44 | 45 | using namespace std; 46 | 47 | // Matrix is stored in descending sky-line format 48 | class cvOneDFEAMatrix{ 49 | protected: 50 | 51 | char title[MAX_STRING_SIZE + 1]; 52 | 53 | public: 54 | 55 | cvOneDFEAMatrix(const char* tit); 56 | virtual ~cvOneDFEAMatrix(); 57 | 58 | // VIRTUAL FUNCTIONS 59 | virtual void Add(cvOneDDenseMatrix& matrix) = 0; 60 | virtual void AddValue( long row, long column, double value) = 0; 61 | virtual void SetValue(long row, long column, double value) = 0; 62 | virtual void Clear() = 0; 63 | virtual void ClearRow(long row) = 0; 64 | virtual void ClearColumn(long column) = 0; 65 | virtual double GetValue(long row, long column) = 0; 66 | virtual long GetDimension() const = 0; 67 | // print matrix 68 | virtual void print(std::ostream &os) = 0; 69 | 70 | }; 71 | 72 | #endif // CVONEDFEAMATRIX_H 73 | -------------------------------------------------------------------------------- /Code/Source/cvOneDFEAVector.h: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #ifndef CVONEDFEAVECTOR_H 33 | #define CVONEDFEAVECTOR_H 34 | 35 | // 36 | // cvOneDFEAVector.h - Header for a class to handle finite element Vectors 37 | // ~~~~~~~~~~~~~ 38 | // 39 | // SYNOPSIS...This is a utility class used to handle the finite element 40 | // Vectors (currentSolution, increment, previousSolution, etc. 41 | // 42 | 43 | #include 44 | 45 | #include "cvOneDSolverDefinitions.h" 46 | 47 | using namespace std; 48 | 49 | enum normType { 50 | L2_norm = 1, 51 | L1_norm, 52 | Linf_norm 53 | }; 54 | 55 | class cvOneDFEAVector{ 56 | protected: 57 | char title[MAX_STRING_SIZE + 1]; 58 | long dimension; 59 | long* equationNumbers; 60 | double* entries; 61 | void CreateVector(long dim, const char* tit = "vector"); 62 | 63 | public: 64 | cvOneDFEAVector(long dim, const char* tit = "vector"); 65 | cvOneDFEAVector(long dim, long* eqNumbers, const char* tit = "vector"); 66 | void SetEquationNumbers(long* eqNumbers); 67 | ~cvOneDFEAVector(); 68 | void Clear(); 69 | void Rename(const char* tit); 70 | void Add(long component, double value); 71 | void Add(cvOneDFEAVector& vector); 72 | // add the components of vector in the global vector in the 73 | // positions specified by its equation numbers 74 | long GetDimension() const {return dimension;} 75 | const long* GetEquationNumbers() const {return equationNumbers;} 76 | double* GetEntries() {return entries;} 77 | double& operator[](long i); 78 | cvOneDFEAVector& operator=(const cvOneDFEAVector& rhs); 79 | cvOneDFEAVector& operator+=(const cvOneDFEAVector& rhs); 80 | void Set(long i, double value); 81 | double Get( long i) const; 82 | double Norm(normType type, int start, int step, int stop_index = -1) const; 83 | void CheckPositive(int start,int step, int stop); 84 | 85 | void print(std::ostream& os); 86 | }; 87 | 88 | #endif // CVONEDFEAVECTOR_H 89 | -------------------------------------------------------------------------------- /Code/Source/cvOneDFiniteElement.cxx: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | // 33 | // FiniteElement.cxx - Source for a class to handle individual finite elements 34 | // ~~~~~~~~~~~~~~~~~ 35 | // 36 | // This class abstracts the finite element one-dimensional shape function 37 | // 38 | 39 | #include 40 | 41 | #include "cvOneDFiniteElement.h" 42 | 43 | // Constuctor 44 | cvOneDFiniteElement::cvOneDFiniteElement(){ 45 | wasSet = false; 46 | } 47 | 48 | // Destructor 49 | cvOneDFiniteElement::~cvOneDFiniteElement(){ 50 | 51 | } 52 | 53 | void cvOneDFiniteElement::Set(double* nd, long* conn){ 54 | nodes[0] = nd[0]; 55 | nodes[1] = nd[1]; 56 | 57 | connectivity[0] = conn[0]; 58 | connectivity[1] = conn[1]; 59 | 60 | wasSet = true; 61 | } 62 | 63 | void cvOneDFiniteElement::Evaluate(double xi, double* shape, double* DxShape, double* jacobian)const{ 64 | assert( wasSet); 65 | 66 | shape[0] = 0.5 * (1.0 - xi); 67 | shape[1] = 0.5 * (1.0 + xi); 68 | 69 | *jacobian = 0.5 * (nodes[1] - nodes[0]); 70 | 71 | DxShape[0] = -0.5 / (*jacobian); 72 | DxShape[1] = 0.5 / (*jacobian); 73 | } 74 | 75 | double cvOneDFiniteElement::Interpolate(double xi, double* values)const{ 76 | double shape[2]; 77 | double aux1[2]; // redundant pointer 78 | double aux2; // redundant value 79 | 80 | Evaluate(xi, shape, aux1, &aux2); 81 | 82 | return values[0] * shape[0] + values[1] * shape[1]; 83 | } 84 | -------------------------------------------------------------------------------- /Code/Source/cvOneDFiniteElement.h: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #ifndef CVONEDFINITEELEMENT_H 33 | #define CVONEDFINITEELEMENT_H 34 | 35 | // 36 | // cvOneDFiniteElement.h - Header for a class to handle individual finite elements 37 | // ~~~~~~~~~~~~~~~~~ 38 | // 39 | // SYNOPSIS...This class abstracts the finite element and provides utilities 40 | // for maintaining a solution. 41 | // 42 | 43 | class cvOneDFiniteElement{ 44 | 45 | public: 46 | 47 | cvOneDFiniteElement(); 48 | virtual ~cvOneDFiniteElement(); 49 | void Set( double* nd, long* conn); 50 | void Evaluate( double xi, double* shape,double* DxShape, double* jacobian)const; 51 | 52 | double Interpolate( double xi, double* values)const; 53 | 54 | private: 55 | 56 | bool wasSet; 57 | double nodes[2]; 58 | long connectivity[2]; 59 | }; 60 | 61 | #endif // CVONEDFINITEELEMENT_H 62 | -------------------------------------------------------------------------------- /Code/Source/cvOneDGlobal.cxx: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #include "cvOneDGlobal.h" 33 | 34 | // GLOBAL FLAGS 35 | bool cvOneDGlobal::isCreating = false; 36 | bool cvOneDGlobal::isSolving = false; 37 | int cvOneDGlobal::outputType = 0; // Default Text Output 38 | int cvOneDGlobal::vtkOutputType = 0; // Default Multiple Files 39 | int cvOneDGlobal::CONSERVATION_FORM = 0; 40 | 41 | // DEBUG MODE 42 | bool cvOneDGlobal::debugMode = false; 43 | 44 | // CURRENT MODEL INDEX 45 | long cvOneDGlobal::currentModel = -1; 46 | 47 | // VECTOR OF CREATED MODELS 48 | vector cvOneDGlobal::gModelList; 49 | 50 | // GLOBAL MATERIAL MANAGER OBJECT 51 | cvOneDMaterialManager* cvOneDGlobal::gMaterialManager = NULL; 52 | 53 | // GLOBAL Mth SEGMENT MODEL 54 | cvOneDMthSegmentModel* cvOneDGlobal::gMthSegmentModel = NULL; 55 | 56 | // GLOBAL SOLVER INSTANCE 57 | cvOneDBFSolver* cvOneDGlobal::gBFSolver = NULL; 58 | 59 | // GLOBAL VECTOR OF DATATABLES 60 | vector cvOneDGlobal::gDataTables; 61 | 62 | // GENERIC SOLVER INSTANCE 63 | cvOneDLinearSolver* cvOneDGlobal::solver = NULL; 64 | -------------------------------------------------------------------------------- /Code/Source/cvOneDGlobal.h: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #ifndef CVONEDGLOBAL_H 33 | #define CVONEDGLOBAL_H 34 | 35 | # include 36 | 37 | # include "cvOneDModel.h" 38 | # include "cvOneDMaterialManager.h" 39 | # include "cvOneDMthSegmentModel.h" 40 | # include "cvOneDDataTable.h" 41 | # include "cvOneDLinearSolver.h" 42 | # include "cvOneDBFSolver.h" 43 | 44 | using namespace std; 45 | 46 | class cvOneDGlobal{ 47 | 48 | public: 49 | 50 | // GLOBAL FLAGS 51 | static bool isCreating; 52 | static bool isSolving; 53 | static int outputType; 54 | static int vtkOutputType; 55 | static int CONSERVATION_FORM; 56 | 57 | // DEBUG MODE 58 | static bool debugMode; 59 | 60 | // CURRENT MODEL INDEX 61 | static long currentModel; 62 | 63 | // VECTOR OF CREATED MODELS 64 | static vector gModelList; 65 | 66 | // GLOBAL MATERIAL MANAGER OBJECT 67 | static cvOneDMaterialManager* gMaterialManager; 68 | 69 | // GLOBAL Mth SEGMENT MODEL 70 | static cvOneDMthSegmentModel* gMthSegmentModel; 71 | 72 | // GLOBAL SOLVER INSTANCE 73 | static cvOneDBFSolver* gBFSolver; 74 | 75 | // GLOBAL VECTOR OF DATATABLES 76 | static vector gDataTables; 77 | 78 | // Generic Solver instance 79 | static cvOneDLinearSolver *solver; 80 | 81 | }; 82 | 83 | #endif // CVONEDGLOBAL_H 84 | 85 | -------------------------------------------------------------------------------- /Code/Source/cvOneDJoint.h: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #ifndef CVONEDJOINT_H 33 | #define CVONEDJOINT_H 34 | 35 | // 36 | // cvOneDJoint.h: A data structure for model joints. 37 | // 38 | 39 | #include 40 | 41 | #include "cvOneDEnums.h" 42 | #include "cvOneDSegment.h" 43 | 44 | using namespace std; 45 | 46 | struct cvOneDBoundCondsJoint{ 47 | cvOneDBoundCondsJoint(){} 48 | ~cvOneDBoundCondsJoint(){} 49 | BoundCondType bcType; 50 | cvOneDBoundCondsJoint& operator=(const cvOneDBoundCondsJoint& in){return *this;} 51 | double bcParameter1; 52 | double bcParameter2; 53 | }; 54 | 55 | struct cvOneDJoint{ 56 | cvOneDJoint(){} 57 | ~cvOneDJoint(){} 58 | cvOneDJoint& operator=(const cvOneDJoint& in){return *this;} 59 | void setJointID(int i){id = i;} 60 | int getNumberOfSegments(){return InletSegments.size()+OutletSegments.size();} 61 | char Name[2048]; 62 | int id; 63 | double x, y, z, radius; 64 | vector theBCs; 65 | vector InletSegments; 66 | vector OutletSegments; 67 | }; 68 | 69 | #endif // CVONEDJOINT_H 70 | -------------------------------------------------------------------------------- /Code/Source/cvOneDLinearSolver.cxx: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | # include "cvOneDLinearSolver.h" 33 | 34 | // Static Declarations 35 | cvOneDFEAMatrix* cvOneDLinearSolver::lhsMatrix; 36 | cvOneDFEAVector* cvOneDLinearSolver::rhsVector; 37 | 38 | cvOneDLinearSolver::cvOneDLinearSolver(){ 39 | 40 | } 41 | 42 | cvOneDLinearSolver::~cvOneDLinearSolver(){ 43 | 44 | } 45 | 46 | -------------------------------------------------------------------------------- /Code/Source/cvOneDLinearSolver.h: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #ifndef CVONEDLINEARSOLVER_H 33 | #define CVONEDLINEARSOLVER_H 34 | 35 | // 36 | // cvOneDLinearSolver.h - Header for a Linear Skyline Matrix Solver 37 | // 38 | // This class provides functionality for solving matrix systems 39 | // presented in the skyline format, and some special manipulations. 40 | // 41 | 42 | # include 43 | 44 | # include "cvOneDFEAMatrix.h" 45 | # include "cvOneDFEAVector.h" 46 | 47 | class cvOneDLinearSolver{ 48 | 49 | public: 50 | 51 | static cvOneDFEAMatrix* lhsMatrix; 52 | static cvOneDFEAVector* rhsVector; 53 | 54 | cvOneDLinearSolver(); 55 | virtual ~cvOneDLinearSolver(); 56 | 57 | virtual void SetLHS( cvOneDFEAMatrix* matrix) = 0; 58 | virtual void SetRHS( cvOneDFEAVector* vector) = 0; 59 | 60 | // matrix is overwritten with its LU decomposition 61 | // solution gets overwritten with the solution of 62 | // the linear system of equations 63 | virtual void Solve(cvOneDFEAVector& solution) = 0; 64 | 65 | virtual cvOneDFEAMatrix* GetLHS() = 0; 66 | virtual cvOneDFEAVector* GetRHS() = 0; 67 | virtual void SetSolution(long equation, double value) = 0; 68 | // when one more constraint (dQ = k_m*dS, resistance boundary 69 | // condition) is added, the basic dense matrix (4x4) is decreased 70 | // to (3x3) 71 | virtual void Minus1dof(long rightBottomEquationNumber, double k_m) = 0; 72 | // direct application of the resistance constraint without reduction, which means 73 | // Newton Raphson scheme is applied on equation Q = PR. Therefore the dense matrix 74 | // is still 4x4. 75 | virtual void DirectAppResistanceBC(long rbEqnNo, double resistance, double dpds, double rhs) = 0; 76 | virtual void AddFlux(long rbEqnNo, double* OutletLHS11, double* OutletRHS1) = 0; 77 | 78 | }; 79 | 80 | #endif // CVONEDLINEARSOLVER_H 81 | -------------------------------------------------------------------------------- /Code/Source/cvOneDMaterialManager.h: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #ifndef CVONEDMATERIALMANAGER_H 33 | #define CVONEDMATERIALMANAGER_H 34 | 35 | # include "cvOneDEnums.h" 36 | # include "cvOneDMaterial.h" 37 | 38 | #define MAX_NUM_OF_MATERIAL_INSTANCES 256 39 | 40 | class cvOneDMaterialManager{ 41 | public: 42 | cvOneDMaterialManager(); 43 | ~cvOneDMaterialManager(); 44 | 45 | int AddNewMaterial(MaterialType type, cvOneDMaterial* mat); 46 | 47 | int AddNewMaterialOlufsen(double density, double dynamicViscosity, 48 | double profile_exponent, double pRef, double *params); 49 | 50 | int AddNewMaterialLinear(double density, double dynamicViscosity, 51 | double profile_exponent, double pRef, double EHR); 52 | 53 | // caller must deallocate material instance to avoid memory leak 54 | cvOneDMaterial* GetNewInstance(int matID); 55 | 56 | private: 57 | int numMaterials; 58 | MaterialType types[MAX_NUM_OF_MATERIAL_INSTANCES]; 59 | cvOneDMaterial* materials[MAX_NUM_OF_MATERIAL_INSTANCES]; 60 | }; 61 | 62 | #endif // CVONEDMATERIALMANAGER_H 63 | 64 | -------------------------------------------------------------------------------- /Code/Source/cvOneDMesh.h: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #ifndef CVONEDMESH_H 33 | #define CVONEDMESH_H 34 | 35 | // 36 | // Mesh.h: Data structure to handle segment meshes 37 | // 38 | 39 | # include "cvOneDEnums.h" 40 | # include "cvOneDVector.h" 41 | 42 | // Have to define Node and Element structures 43 | struct cvOneDMeshNode{ 44 | long id; // Node ID 45 | 46 | double x; // Node Position; 47 | double y; 48 | double z; 49 | 50 | double Q; // Output Values; 51 | double A; 52 | }; 53 | 54 | struct cvOneDElement{ 55 | long id; // Element ID 56 | 57 | long inNode; // inletNode; 58 | long outNode; // outletNode; 59 | 60 | double h; // Element size 61 | }; 62 | 63 | // Mesh simply maintains the Nodes and Elements; 64 | struct cvOneDMesh{ 65 | cvOneDVector NodesList; 66 | cvOneDVector ElementList; 67 | }; 68 | 69 | #endif // CVONEDMESH_H 70 | 71 | -------------------------------------------------------------------------------- /Code/Source/cvOneDModelManager.h: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #ifndef CVONEDMODELMANAGER_H 33 | #define CVONEDMODELMANAGER_H 34 | 35 | # include 36 | # include 37 | 38 | # include "cvOneDTypes.h" 39 | # include "cvOneDGlobal.h" 40 | # include "cvOneDException.h" 41 | # include "cvOneDModel.h" 42 | 43 | class cvOneDModelManager{ 44 | public: 45 | // CONSTRUCTOR 46 | cvOneDModelManager(char *mdlName); 47 | // DESTUCTOR 48 | ~cvOneDModelManager(); 49 | 50 | // CREATE MATERIAL 51 | int CreateMaterial(char *matName, char *MaterialTypeString, 52 | double density, double dynamicViscosity, 53 | double profile_exponent, double pRef, 54 | int numParams, double *params, int *matID); 55 | 56 | // CREATE SEGMENT 57 | int CreateSegment(char* segName,long segID, double segLen, 58 | long numEls,long inNode,long outNode, 59 | double InitialInletArea,double InitialOutletArea, 60 | double InitialFlow,int matID,char* lossType, 61 | double branchAngle,int upstreamSegment,int branchSegment, 62 | char* boundType,double* value, double* time, int num ); 63 | 64 | // CREATE DATATABLE 65 | int CreateDataTable(char* dtName,char* dtType, cvDoubleVec values); 66 | 67 | // CREATE NODE 68 | int CreateNode(char* nodeName,double x,double y,double z); 69 | 70 | 71 | // CREATE JOINT 72 | int CreateJoint(const char* jointName,double x,double y,double z, 73 | int numInSegs,int numOutSegs, 74 | int *InSegs,int *OutSegs); 75 | 76 | // SOLVE MODEL 77 | int SolveModel(double dt,long stepSize, 78 | long maxStep,long quadPoints, 79 | int len,char* boundType,double* values, 80 | double* times,double conv, int useIV, int usestab); 81 | 82 | }; 83 | 84 | #endif // CVONEDMODELMANAGER_H 85 | -------------------------------------------------------------------------------- /Code/Source/cvOneDMthBranchModel.h: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #ifndef CVONEDMTHBRANCHMODEL_H 33 | #define CVONEDMTHBRANCHMODEL_H 34 | 35 | // 36 | // cvOneDMthBranchModel.h 37 | // ~~~~~~~~~~~~~~~~~~ 38 | // 39 | // Mathematical formulations of joints. Lagrange multipliers are used to have 40 | // pressure continuity and mass conservation (flux conservation) at joints. 41 | // 42 | 43 | 44 | # include "cvOneDMthModelBase.h" 45 | # include "cvOneDFEAVector.h" 46 | # include "cvOneDFEAMatrix.h" 47 | 48 | class cvOneDMthBranchModel: public cvOneDMthModelBase{ 49 | 50 | public: 51 | 52 | cvOneDMthBranchModel(const vector &subdList, 53 | const vector &jtList, const vector& outletList); 54 | ~cvOneDMthBranchModel(){} 55 | int GetNumberOfJoints() {return numOfJoints;} 56 | void FormNewton(cvOneDFEAMatrix* lhsMatrix, cvOneDFEAVector* rhsVector); 57 | void GetEquationNumbers(long ele, long* eqNumbers, long ithJoint); 58 | long GetUpmostEqnNumber(long ele, long ithJoint); 59 | 60 | private: 61 | 62 | void FormLagrangeRHSbyP(long ithJoint, cvOneDFEAVector* rhsVector); 63 | void FormLagrangeRHSbyQ(long ithJoint, cvOneDFEAVector* rhsVector); 64 | void FormLagrangeLHSbyP(long ithJoint, cvOneDFEAMatrix* lhs); 65 | void FormLagrangeLHSbyQ(long ithJoint, cvOneDFEAMatrix* lhs); 66 | int numOfJoints; 67 | }; 68 | 69 | #endif // CVONEDMTHBRANCHMODEL_H 70 | -------------------------------------------------------------------------------- /Code/Source/cvOneDNode.h: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #ifndef CVONEDNODE_H 33 | #define CVONEDNODE_H 34 | 35 | // 36 | // cvOneDNode.h: A data structure for model nodes. 37 | // 38 | 39 | #include 40 | #include "cvOneDEnums.h" 41 | #include "cvOneDSegment.h" 42 | 43 | using namespace std; 44 | struct cvOneDBoundConds{ 45 | 46 | cvOneDBoundConds(){} 47 | ~cvOneDBoundConds(){} 48 | BoundCondType bcType; 49 | cvOneDBoundConds& operator=(const cvOneDBoundConds& in){return *this;} 50 | double bcParameter1; double bcParameter2; 51 | }; 52 | 53 | struct cvOneDNode{ 54 | cvOneDNode(){} 55 | ~cvOneDNode(){} 56 | cvOneDNode& operator=(const cvOneDNode& in){return *this;} 57 | void setNodeID(int i){id = i;} 58 | char Name[2048]; 59 | int id; 60 | double x, y, z, radius; 61 | vector theBCs; 62 | }; 63 | 64 | #endif // CVONEDNODE_H 65 | -------------------------------------------------------------------------------- /Code/Source/cvOneDOptionsJsonParser.h: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Stanford University, The Regents of the University of 3 | * California, and others. 4 | * 5 | * All Rights Reserved. 6 | * 7 | * See Copyright-SimVascular.txt for additional details. 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining 10 | * a copy of this software and associated documentation files (the 11 | * "Software"), to deal in the Software without restriction, including 12 | * without limitation the rights to use, copy, modify, merge, publish, 13 | * distribute, sublicense, and/or sell copies of the Software, and to 14 | * permit persons to whom the Software is furnished to do so, subject 15 | * to the following conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be included 18 | * in all copies or substantial portions of the Software. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 21 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 23 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 24 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef CVONEDOPTIONSJSONPARSER_H 34 | #define CVONEDOPTIONSJSONPARSER_H 35 | 36 | #include "cvOneDOptions.h" 37 | 38 | using namespace std; 39 | 40 | namespace cvOneD{ 41 | 42 | options readJsonOptions(string const& inputFile); 43 | 44 | } // namespace cvOneD 45 | 46 | #endif // CVONEDOPTIONSJSONPARSER_H 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Code/Source/cvOneDOptionsJsonSerializer.h: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Stanford University, The Regents of the University of 3 | * California, and others. 4 | * 5 | * All Rights Reserved. 6 | * 7 | * See Copyright-SimVascular.txt for additional details. 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining 10 | * a copy of this software and associated documentation files (the 11 | * "Software"), to deal in the Software without restriction, including 12 | * without limitation the rights to use, copy, modify, merge, publish, 13 | * distribute, sublicense, and/or sell copies of the Software, and to 14 | * permit persons to whom the Software is furnished to do so, subject 15 | * to the following conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be included 18 | * in all copies or substantial portions of the Software. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 21 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 23 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 24 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef CVONEDOPTIONSJSONSERIALIZER_H 34 | #define CVONEDOPTIONSJSONSERIALIZER_H 35 | 36 | #include "cvOneDOptions.h" 37 | 38 | using namespace std; 39 | 40 | namespace cvOneD{ 41 | 42 | void writeJsonOptions(options const& opts, string const& fileName); 43 | 44 | } // namespace cvOneD 45 | 46 | #endif // CVONEDOPTIONSJSONSERIALIZER_H 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Code/Source/cvOneDOptionsLegacySerializer.h: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #ifndef CVONEDOPTIONSLEGACYSERIALIZER_H 33 | #define CVONEDOPTIONSLEGACYSERIALIZER_H 34 | 35 | #include "cvOneDOptions.h" 36 | 37 | using namespace std; 38 | 39 | namespace cvOneD{ 40 | 41 | void readOptionsLegacyFormat(string inputFile, options* opts); 42 | 43 | void printToLegacyFile(options const& opts, string const& fileName); 44 | 45 | } // namespace cvOneD 46 | 47 | #endif // CVONEDOPTIONSLEGACYSERIALIZER_H 48 | 49 | -------------------------------------------------------------------------------- /Code/Source/cvOneDSolverDefinitions.h: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #ifndef CVONEDSOLVERDEFINITIONS_H 33 | #define CVONEDSOLVERDEFINITIONS_H 34 | 35 | 36 | // 37 | // cvOneDSolverDefinitions.h - Some definitions used throughout the solver 38 | // 39 | 40 | #define MAX_STRING_SIZE 20 41 | #define EPSILON 1.0e-10 42 | #define OUTPUT_PRECISION 12 43 | #define MAX_NONLINEAR_ITERATIONS 30 44 | #define RELATIVE_TOLERANCE 1.0e-7 45 | #define ABSOLUTE_TOLERANCE 5.0e-6 46 | 47 | #endif // CVONEDSOLVERDEFINITIONS_H 48 | 49 | -------------------------------------------------------------------------------- /Code/Source/cvOneDString.cxx: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | 33 | // 34 | // cvOneDString.cpp - Source for a simple string class. 35 | // 36 | 37 | # include 38 | # include 39 | 40 | # include "cvOneDString.h" 41 | 42 | cvOneDString::cvOneDString(){ 43 | len = 0; 44 | theData = 0; 45 | } 46 | 47 | cvOneDString::cvOneDString(const char* str){ 48 | len = strlen( str); 49 | theData = new char[len + 1]; 50 | assert( theData != 0); 51 | strcpy( theData, str); 52 | } 53 | 54 | cvOneDString::cvOneDString(const cvOneDString& str){ 55 | len = str.len; 56 | theData = new char[len + 1]; 57 | assert( theData != 0); 58 | strcpy( theData, str.theData); 59 | } 60 | 61 | cvOneDString::~cvOneDString(){ 62 | delete [] theData; 63 | } 64 | 65 | const char* cvOneDString::data(){ 66 | return theData; 67 | } 68 | 69 | cvOneDString cvOneDString::operator+(const char* rhs){ 70 | cvOneDString str = *this; 71 | str += rhs; 72 | return str; 73 | } 74 | 75 | cvOneDString& cvOneDString::operator+=(const char* rhs){ 76 | len += strlen( rhs); 77 | char *p = new char[ len + 1]; 78 | assert( p != 0); 79 | strcpy( p, theData); 80 | strcat( p, rhs); 81 | delete [] theData; 82 | theData = p; 83 | 84 | return *this; 85 | } 86 | 87 | const cvOneDString& cvOneDString::operator=(const cvOneDString& rhs){ 88 | len = rhs.len; 89 | delete [] theData; 90 | theData = new char[len + 1]; 91 | strcpy( theData, rhs.theData); 92 | 93 | return *this; 94 | } 95 | -------------------------------------------------------------------------------- /Code/Source/cvOneDString.h: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #ifndef CVONEDSTRING_H 33 | #define CVONEDSTRING_H 34 | 35 | // 36 | // cvOneDString.h - Header for a simple string class. 37 | // 38 | 39 | class cvOneDString{ 40 | 41 | public: 42 | 43 | cvOneDString(); 44 | cvOneDString(const char* str); 45 | cvOneDString(const cvOneDString& str); 46 | ~cvOneDString(); 47 | const char* data(); 48 | 49 | const cvOneDString& operator=(const cvOneDString& rhs); 50 | cvOneDString operator+(const char* rhs); 51 | cvOneDString& operator+=(const char* rhs); 52 | 53 | private: 54 | 55 | long len; 56 | char* theData; 57 | }; 58 | 59 | #endif // CVONEDSTRING_H 60 | 61 | -------------------------------------------------------------------------------- /Code/Source/cvOneDTypes.h: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #ifndef CVONEDTYPES_H 33 | #define CVONEDTYPES_H 34 | 35 | # include 36 | # include 37 | 38 | using namespace std; 39 | 40 | // CONSTANTS 41 | const int CV_STRLEN = 256; 42 | 43 | // RETURN VALUES 44 | const int CV_ERROR = -1; 45 | const int CV_OK = 0; 46 | 47 | // TYPES 48 | 49 | // STRUCTS 50 | struct cvOneDKentry{ 51 | int row; 52 | int col; 53 | double value; 54 | }; 55 | 56 | // Vectors 57 | typedef vector cvStringVec; 58 | typedef vector cvLongVec; 59 | typedef vector cvDoubleVec; 60 | 61 | // Matrices 62 | typedef vector > cvStringMat; 63 | typedef vector > cvLongMat; 64 | typedef vector > cvDoubleMat; 65 | 66 | #endif // CVONEDTYPES_H 67 | 68 | -------------------------------------------------------------------------------- /Code/Source/cvOneDUtility.h: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #ifndef CVONEDUTILITY_H 33 | #define CVONEDUTILITY_H 34 | 35 | // 36 | // cvOneDUtility.h - Header for Some Utility functions and rules of random point quadratures. 37 | // ~~~~~~~~~~~ 38 | // 39 | 40 | # include 41 | # include 42 | # include 43 | # include 44 | # include 45 | 46 | # include "cvOneDTypes.h" 47 | # include "cvOneDException.h" 48 | 49 | const int MaxChar = 128; 50 | 51 | std::vector split_string(std::string& s, const std::string& delims); 52 | std::string trim_string(const std::string& s); 53 | std::string upper_string(const std::string& s); 54 | 55 | long min(long a, long b); 56 | long max( long a, long b); 57 | long min( long size, long* values); 58 | long sum( long size, long* values); 59 | void clear( long size, long* vec); 60 | // Calculates the modulus of the 2x2 matrix A and put the results 61 | // in modulusA using Cayley-Hamilton theory 62 | void GetModulus(double* A, double* modulusA); 63 | 64 | class cvOneDQuadrature{ 65 | public: 66 | cvOneDQuadrature( int n); 67 | ~cvOneDQuadrature(); 68 | void Get( double* w, double* x) const; 69 | 70 | private: 71 | // number of integration points in the quadrature 72 | int npts; 73 | double* xi; 74 | double* weights; 75 | }; 76 | 77 | int getListIDWithStringKey(string key,cvStringVec list); 78 | 79 | #endif // CVONEDUTILITY_H 80 | -------------------------------------------------------------------------------- /Code/Source/header: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | -------------------------------------------------------------------------------- /Code/Source/oneDSolver.i: -------------------------------------------------------------------------------- 1 | %module oneDSolver 2 | 3 | %{ 4 | /* Includes the header in the wrapper code */ 5 | #include "cvOneDOptions.h" 6 | #include "main.h" 7 | using namespace std; 8 | %} 9 | 10 | /* Parse the header file to generate wrappers */ 11 | %include 12 | %include 13 | %include 14 | %include 15 | 16 | %apply const int & { int & }; 17 | %apply const double & { double & }; 18 | 19 | %include "cvOneDOptions.h" 20 | %include "main.h" 21 | 22 | namespace std{ 23 | typedef std::string String; 24 | // Vectors 25 | %template(cvStringVec) vector< string >; 26 | %template(cvLongVec) vector< long >; 27 | %template(cvDoubleVec) vector< double >; 28 | // Matrices 29 | %template(cvStringMat) vector< vector< string > >; 30 | %template(cvLongMat) vector< vector< long > >; 31 | %template(cvDoubleMat) vector< vector< double > >; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /Code/Source/rename.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | for f in *.h; do 3 | cat header $f > $f.tmp 4 | mv $f.tmp $f 5 | done 6 | -------------------------------------------------------------------------------- /Code/Source/sparse/csparse/csparseSolve.cxx: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #include "csparseSolve.h" 33 | #include "../../cvOneDException.h" 34 | 35 | extern "C" { 36 | #include "csparse.h" 37 | } 38 | 39 | int csparseSolve(cvOneDKentry* Kentries,double *b,int numEntries, int NNZ,int nunknown,double u[]){ 40 | 41 | // Set Tolerance 42 | double tol = 1.0e-12; 43 | // Set Sparse Ordering AMD 44 | int sparseOrdering = 1; 45 | // Init Matrix 46 | // Aux Triplet Matrix 47 | cs* T = new cs(); 48 | // Sparse Matrix 49 | cs* A; 50 | 51 | // Assign Matrix Entries in Triplet Format 52 | T->nzmax = numEntries; 53 | T->nz = NNZ; 54 | T->m = nunknown; 55 | T->n = nunknown; 56 | T->p = new int[NNZ]; // Column Indices 57 | T->i = new int[NNZ]; // Row Indices 58 | T->x = new double[NNZ]; // Numerical Values 59 | int j=0; 60 | for(int i=0;ii[j] = Kentries[i].row; 63 | T->p[j] = Kentries[i].col; 64 | T->x[j] = Kentries[i].value; 65 | j++; 66 | } 67 | } 68 | 69 | // Convert Matrix in Compressed Solumn Format 70 | A = cs_triplet(T); 71 | 72 | // Solve system 73 | int ok = cs_lusol(A,b,sparseOrdering,tol); 74 | if (ok == 0){ 75 | std::string errorMsg("Error: Cannot Solve Linear System\n"); 76 | throw cvException(errorMsg.c_str()); 77 | } 78 | 79 | // Copy Solution Back 80 | for(int loopA=0;loopA 36 | # include 37 | # include 38 | 39 | # include "../../cvOneDTypes.h" 40 | 41 | int csparseSolve(cvOneDKentry* Kentries, double *b,int numEntries, int NNZ,int nunknown,double u[]); 42 | 43 | #endif // CSPARSESOLVE_H 44 | -------------------------------------------------------------------------------- /Code/Source/sparse/cvOneDSparseLinearSolver.h: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #ifndef CVONEDSPARSELINEARSOLVER_H 33 | #define CVONEDSPARSELINEARSOLVER_H 34 | 35 | // 36 | // cvOneDSparseLinearSolver.h - Header for a Linear Sparse Matrix Solver 37 | // ~~~~~~~~~~~~~~~~ 38 | // 39 | // This class provides functionality for solving matrix systems 40 | // presented in the skyline format, and some special manipulations. 41 | // 42 | 43 | # include 44 | # include 45 | 46 | # include "../cvOneDLinearSolver.h" 47 | # include "cvOneDSparseMatrix.h" 48 | # include "../cvOneDFEAMatrix.h" 49 | # include "../cvOneDFEAVector.h" 50 | 51 | class cvOneDSparseLinearSolver: public cvOneDLinearSolver{ 52 | 53 | public: 54 | 55 | cvOneDSparseLinearSolver(); 56 | virtual ~cvOneDSparseLinearSolver(); 57 | 58 | virtual void SetLHS( cvOneDFEAMatrix* matrix); 59 | virtual void SetRHS( cvOneDFEAVector* vector); 60 | 61 | // matrix is overwritten with its LU decomposition 62 | // solution gets overwritten with the solution of 63 | // the linear system of equations 64 | virtual void Solve( cvOneDFEAVector& solution); 65 | 66 | virtual cvOneDFEAMatrix* GetLHS(); 67 | virtual cvOneDFEAVector* GetRHS(); 68 | virtual void SetSolution(long equation, double value); 69 | // when one more constraint (dQ = k_m*dS, resistance boundary 70 | // condition) is added, the basic dense matrix (4x4) is decreased 71 | // to (3x3) 72 | virtual void Minus1dof( long rightBottomEquationNumber, double k_m); 73 | // direct application of the resistance constraint without reduction, which means 74 | // Newton Raphson scheme is applied on equation Q = PR. Therefore the dense matrix 75 | // is still 4x4. 76 | virtual void DirectAppResistanceBC(long rbEqnNo, double resistance, double dpds, double rhs); 77 | virtual void AddFlux(long rbEqnNo, double* OutletLHS11, double* OutletRHS1); 78 | }; 79 | 80 | #endif // CVONEDSPARSELINEARSOLVER_H 81 | -------------------------------------------------------------------------------- /Code/Source/sparse/superlu/superLUSolve.h: -------------------------------------------------------------------------------- 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. 30 | */ 31 | 32 | #ifndef SUPERLUSOLVE_H 33 | #define SUPERLUSOLVE_H 34 | 35 | # include 36 | # include 37 | # include 38 | 39 | # include "../../cvOneDTypes.h" 40 | 41 | int superLUSolve(cvOneDKentry* Kentries, double *b,int numEntries, int NNZ,int nunknown,double u[]); 42 | 43 | #endif // SUPERLUSOLVE_H 44 | -------------------------------------------------------------------------------- /Copyright-SimVascular.txt: -------------------------------------------------------------------------------- 1 | 2 | C-style copyright notice: 3 | 4 | /* Copyright (c) Stanford University, The Regents of the University of 5 | * California, and others. 6 | * 7 | * All Rights Reserved. 8 | * 9 | * See Copyright-SimVascular.txt for additional details. 10 | * 11 | * Permission is hereby granted, free of charge, to any person obtaining 12 | * a copy of this software and associated documentation files (the 13 | * "Software"), to deal in the Software without restriction, including 14 | * without limitation the rights to use, copy, modify, merge, publish, 15 | * distribute, sublicense, and/or sell copies of the Software, and to 16 | * permit persons to whom the Software is furnished to do so, subject 17 | * to the following conditions: 18 | * 19 | * The above copyright notice and this permission notice shall be included 20 | * in all copies or substantial portions of the Software. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 23 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 24 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 26 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | Script copyright notice: 36 | 37 | # Copyright (c) Stanford University, The Regents of the University of 38 | # California, and others. 39 | # 40 | # All Rights Reserved. 41 | # 42 | # See Copyright-SimVascular.txt for additional details. 43 | # 44 | # Permission is hereby granted, free of charge, to any person obtaining 45 | # a copy of this software and associated documentation files (the 46 | # "Software"), to deal in the Software without restriction, including 47 | # without limitation the rights to use, copy, modify, merge, publish, 48 | # distribute, sublicense, and/or sell copies of the Software, and to 49 | # permit persons to whom the Software is furnished to do so, subject 50 | # to the following conditions: 51 | # 52 | # The above copyright notice and this permission notice shall be included 53 | # in all copies or substantial portions of the Software. 54 | # 55 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 56 | # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 57 | # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 58 | # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 59 | # OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 60 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 61 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 62 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 63 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 64 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 65 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 66 | 67 | Portions of the code may be copyright: 68 | 69 | Bill Katz 70 | Charles Taylor 71 | Ken Wang 72 | Nathan Wilson 73 | Open Source Medical Software Corporation 74 | -------------------------------------------------------------------------------- /Distribution/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Set cpack variables to generate the solver installer. 2 | # 3 | # The installers for the different platforms are 4 | # 5 | # Linux - The solver is packaged in a DEB file using the 'deb' cpack generator. 6 | # MacOS - The solver is packaged in a PKG file using the 'productbuild' cpack generator. 7 | # 8 | # The solver install directory structure is defined by the variables 9 | # 10 | # SV_SOLVER_INSTALL_DIR/sv1dsolver/SOLVER_INSTALL_VERSION_DIR 11 | # 12 | # These variables are derived from variables set in SimVascular CMake files 13 | # 14 | # SV_SOLVER_INSTALL_DIR - The plugins install directory, set in SimVascular/Code/CMake/SimVascularSystemSetup.cmake. 15 | # This includes the main install directory and SimVascular version. 16 | # 17 | include(CPackComponent) 18 | 19 | ## Set general package information. 20 | # 21 | set(SOLVER_NAME "oneDSolver") 22 | set(CPACK_PACKAGE_NAME "oneD-solver") 23 | set(CPACK_PACKAGE_VENDOR "SimVascular.org") 24 | set(CPACK_PACKAGE_CONTACT "SimVascular") 25 | set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "1D Solver") 26 | set(SOLVER_INSTALL_SCRIPT_DIR ".") 27 | 28 | ## Set the solver installation directory. 29 | if (UNIX) 30 | set(SV_SOLVER_INSTALL_DIR "/usr/local/sv/") 31 | endif() 32 | 33 | string(REPLACE "." "-" SV_SOLVER_INSTALL_VERSION_DIR ${SV_FULL_VERSION}) 34 | #string(REPLACE "." "-" SV_SOLVER_INSTALL_VERSION_DIR ${SimVascular_VERSION}) 35 | 36 | if (UNIX) 37 | set(CPACK_PACKAGING_INSTALL_PREFIX "${SV_SOLVER_INSTALL_DIR}/${SOLVER_NAME}/${SV_SOLVER_INSTALL_VERSION_DIR}") 38 | endif() 39 | 40 | message(STATUS "SimVascular_VERSION: ${SimVascular_VERSION}") 41 | message(STATUS "SV_SOLVER_INSTALL_DIR: ${SV_SOLVER_INSTALL_DIR}") 42 | message(STATUS "SV_SOLVER_INSTALL_VERSION_DIR: ${SV_SOLVER_INSTALL_VERSION_DIR}") 43 | message(STATUS "CPACK_PACKAGING_INSTALL_PREFIX: ${CPACK_PACKAGING_INSTALL_PREFIX}") 44 | 45 | ## Set the generators used to create the install file and create a setup.sh script 46 | # that sets environment variables to locate the solver libraries. 47 | # 48 | if(APPLE) 49 | set(CPACK_GENERATOR "productbuild") 50 | #set(CPACK_COMPONENTS_ALL libraries) 51 | set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-darwin-x64-${SV_FULL_VERSION}${INSTALL_TYPE_STR}") 52 | set(SOLVER_SETUP_SCRIPT "setup.sh") 53 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/setup-macos.in ${SOLVER_SETUP_SCRIPT}) 54 | 55 | elseif(LINUX) 56 | set(CPACK_GENERATOR DEB) 57 | set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-linux-x64-${SV_FULL_VERSION}${INSTALL_TYPE_STR}") 58 | set(SOLVER_SETUP_SCRIPT "setup.sh") 59 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/setup-linux.in ${SOLVER_SETUP_SCRIPT}) 60 | 61 | # [TODO] This needs to be finished. 62 | elseif(WIN32) 63 | set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-windows-win-x64-${SV_FULL_VERSION}${INSTALL_TYPE_STR}") 64 | set(CPACK_MONOLITHIC_INSTALL 1) 65 | set(CPACK_COMPONENTS_IGNORE_GROUPS 1) 66 | endif() 67 | 68 | ## Install setup script into plugin directory. 69 | install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${SOLVER_SETUP_SCRIPT} DESTINATION ${SOLVER_INSTALL_SCRIPT_DIR}) 70 | 71 | ## Include CPack to introduce the appropriate targets 72 | include(CPack) 73 | 74 | -------------------------------------------------------------------------------- /Distribution/setup-linux.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash -f 2 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$1/lib: 3 | -------------------------------------------------------------------------------- /Distribution/setup-macos.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash -f 2 | export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$1/lib: 3 | -------------------------------------------------------------------------------- /Tests/SystemTests/.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__/ -------------------------------------------------------------------------------- /Tests/SystemTests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimVascular/svOneDSolver/66b31b4221b8dc9c04a767ed48e6a5367f63a499/Tests/SystemTests/__init__.py -------------------------------------------------------------------------------- /Tests/SystemTests/cases/bifurcation_R.in: -------------------------------------------------------------------------------- 1 | # Modelled from aortic bifurcation test case from 2 | # Xiao, N., Alastruey, J., Figueroa, C.A. A systematic comparison between 1-D and 3-D hemodynamics in compliant arterial models. Int J Numer Meth Bio, 2014; 30:204-231 3 | 4 | MODEL results_bifurcation_R_ 5 | 6 | NODE 0 0.0 0.0 0.0 7 | NODE 1 0.0 0.0 -8.6 8 | NODE 2 0.0 -3.25280917510326 -7.85297602634594 9 | NODE 3 0.0 3.25280917510326 -7.85297602634594 10 | 11 | JOINT JOINT1 1 INSEGS OUTSEGS 12 | JOINTINLET INSEGS 1 0 13 | JOINTOUTLET OUTSEGS 2 1 2 14 | 15 | SEGMENT seg0 0 8.6 50 0 1 2.32352192659501 2.32352192659501 0.0 MAT1 NONE 0.0 0 0 NOBOUND NONE 16 | SEGMENT seg1 1 8.5 50 1 3 1.13097335529233 1.13097335529233 0.0 MAT1 NONE 0.0 0 0 RESISTANCE R_VALS 17 | SEGMENT seg2 2 8.5 50 1 2 1.13097335529233 1.13097335529233 0.0 MAT1 NONE 0.0 0 0 RESISTANCE R_VALS 18 | 19 | DATATABLE R_VALS LIST 20 | 0.0 991.36 21 | ENDDATATABLE 22 | 23 | DATATABLE STEADY_FLOW LIST 24 | 0.0 7.985 25 | 1.0 7.985 26 | ENDDATATABLE 27 | 28 | DATATABLE PULS_FLOW LIST 29 | 0.0 0.0 30 | 0.019668108360095 -4.11549971450822 31 | 0.055247073448669 -7.16517105402019 32 | 0.089913757381125 -1.16130916560675 33 | 0.113633067440174 9.27967911020849 34 | 0.133703252874754 20.4428655623545 35 | 0.150124313684865 32.8883708080991 36 | 0.162896249870507 43.9606301469767 37 | 0.173843623743914 54.6495650354764 38 | 0.186615559929556 67.3593157640345 39 | 0.204861183051901 79.6320314281343 40 | 0.234784004972547 86.0097422945109 41 | 0.26872086398011 78.7468811589053 42 | 0.294264736351393 64.7319679994526 43 | 0.314334921785973 52.023318573387 44 | 0.32893142028385 41.4040199668672 45 | 0.34535248109396 29.7287601931208 46 | 0.363598104216306 17.3938305987427 47 | 0.380019165026417 6.42196693062957 48 | 0.396440225836527 -5.11194051566898 49 | 0.422389556499419 -18.901261909892 50 | 0.455347523345814 -23.8602212809087 51 | 0.496182965572016 -18.2411583475954 52 | 0.533485128399922 -10.4792705793446 53 | 0.575247332435512 -4.00466780439001 54 | 0.640931575675956 -2.79835885098868 55 | 0.682440368279291 -5.30400645008189 56 | 0.726077816913567 -8.52809746163143 57 | 0.762721110017611 -9.03919130533637 58 | 0.802405340308712 -7.30944473123762 59 | 0.846498929521047 -5.55578067364513 60 | 0.885944229033165 -5.87317544184486 61 | 0.925563296384544 -7.14939949266443 62 | 0.968258054490832 -6.10169723438909 63 | 1.00949316274733 -4.10721983893183 64 | 1.05237037708484 -3.31554531122748 65 | 1.087 -1.77083891076532 66 | ENDDATATABLE 67 | 68 | 69 | # Ref Pressure 1333.22*85 where 85 is in mmHg 70 | # Rigid for now, but can be elastic with the following parameters: 71 | # h_0 = 1.032mm, E_0 = 500 kPa, h_1 = h_2 = 0.72 mm, E_1 = E_2 = 700 kPa 72 | MATERIAL MAT1 OLUFSEN 1.06 0.04 0 2.0 1.0e15 -20 1e9 73 | 74 | SOLVEROPTIONS 0.001087 50 1000 2 STEADY_FLOW FLOW 1.0e-6 1 1 75 | 76 | OUTPUT TEXT 77 | 78 | 79 | # analytical solution 80 | 81 | # parameters 82 | # viscosity mu 0.04 83 | # seg0 length L_0 8.6 84 | # seg0 radius r_0 0.86 85 | # seg1 length L_1 8.5 (same as seg2 length) 86 | # seg1 radius r_1 0.6 (same as seg2 radius) 87 | # resistance BC R 991.36 88 | # steady Inlet Flow Q_0 7.985 89 | # Distal pressure Pd 0 90 | 91 | # reference solution 92 | # assumes no pressure losses at bifurcation and purely parallel resistances 93 | # total 1D model resistance Rtot = (R_0 + 0.5*(R_2 + R) 94 | # Pressure at junction P_0_out = P_1_in = P_2_in 95 | 96 | # Results to be checked 97 | # P_0_in 3997.46433118937 98 | # P_0_out 3984.67700709878 99 | # P_1_in 3984.67700709878 (same as P_2_in) 100 | # P_1_out 3958.0048 (same as P_2_out because symmetric) 101 | # Q_1_in 3.9925 (same as Q_1_out) 102 | 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /Tests/SystemTests/cases/bifurcation_RCR_staticFunc.in: -------------------------------------------------------------------------------- 1 | # ================================ 2 | # Bifurcation_RCR_stat_ MODEL - UNITS IN CGS 3 | # ================================ 4 | 5 | # ========== 6 | # MODEL CARD 7 | # ========== 8 | # - Name of the model (string) 9 | 10 | MODEL results_bifurcation_RCR_staticFunc_ 11 | 12 | # Modelled from aortic bifurcation test case from 13 | # Xiao, N., Alastruey, J., Figueroa, C.A. A systematic comparison between 1-D and 3-D hemodynamics in compliant arterial models. Int J Numer Meth Bio, 2014; 30:204-231 14 | 15 | NODE 0 0.0 0.0 0.0 16 | NODE 1 0.0 0.0 -8.6 17 | NODE 2 0.0 -3.25280917510326 -7.85297602634594 18 | NODE 3 0.0 3.25280917510326 -7.85297602634594 19 | 20 | JOINT JOINT1 1 INSEGS OUTSEGS 21 | JOINTINLET INSEGS 1 0 22 | JOINTOUTLET OUTSEGS 2 1 2 23 | 24 | SEGMENT seg0 0 8.6 50 0 1 2.32352192659501 2.32352192659501 0.0 MAT1 NONE 0.0 0 0 NOBOUND NONE 25 | SEGMENT seg1 1 8.5 50 1 3 1.13097335529233 1.13097335529233 0.0 MAT1 NONE 0.0 0 0 RCR RCR_VALS 26 | SEGMENT seg2 2 8.5 50 1 2 1.13097335529233 1.13097335529233 0.0 MAT1 NONE 0.0 0 0 RCR RCR_VALS 27 | 28 | # Emulating R boundary condition for static testing 29 | # C = 0 30 | DATATABLE RCR_VALS LIST 31 | 0.0 681.23 32 | 0.0 0.000001 33 | 0.0 310.13 34 | ENDDATATABLE 35 | 36 | DATATABLE STEADY_FLOW LIST 37 | 0.0 7.985 38 | 1.0 7.985 39 | ENDDATATABLE 40 | 41 | DATATABLE PULS_FLOW LIST 42 | 0.0 -2.771464 43 | 0.0453 -5.428778 44 | 0.0906 -0.831727 45 | 0.1359 22.769021 46 | 0.1812 61.189255 47 | 0.2265 85.102185 48 | 0.2717 76.253549 49 | 0.317 49.82679 50 | 0.3623 18.281302 51 | 0.4076 -11.231435 52 | 0.4529 -23.049651 53 | 0.4982 -17.567573 54 | 0.5435 -8.840747 55 | 0.5888 -3.709619 56 | 0.6341 -3.070026 57 | 0.6794 -5.165859 58 | 0.7247 -8.097845 59 | 0.77 -8.892455 60 | 0.8153 -6.543064 61 | 0.8605 -5.715826 62 | 0.9058 -6.591712 63 | 0.9511 -6.406703 64 | 0.9964 -5.173448 65 | 1.0417 -2.825325 66 | 1.087 -2.771464 67 | ENDDATATABLE 68 | 69 | 70 | # Ref Pressure 1333.22*85 where 85 is in mmHg 71 | # Rigid for now, but can be elastic with the following parameters: 72 | # h_0 = 1.032mm, E_0 = 500 kPa, h_1 = h_2 = 0.72 mm, E_1 = E_2 = 700 kPa 73 | MATERIAL MAT1 OLUFSEN 1.06 0.04 0 2.0 1.0e15 -20 1e9 74 | 75 | SOLVEROPTIONS 0.001087 10 100 2 STEADY_FLOW FLOW 1.0e-8 1 1 76 | 77 | OUTPUT TEXT 78 | 79 | 80 | # analytical solution 81 | 82 | # parameters 83 | # viscosity mu 0.04 84 | # seg0 length L_0 8.6 85 | # seg0 radius r_0 0.86 86 | # seg1 length L_1 8.5 (same as seg2 length) 87 | # seg1 radius r_1 0.6 (same as seg2 radius) 88 | # resistance BC R 991.36 89 | # steady Inlet Flow Q_0 7.985 90 | # Distal pressure Pd 0 91 | 92 | # reference solution 93 | # assumes no pressure losses at bifurcation and purely parallel resistances 94 | # total 1D model resistance Rtot = (R_0 + 0.5*(R_2 + R) 95 | # Pressure at junction P_0_out = P_1_in = P_2_in 96 | 97 | # Results to be checked 98 | # P_0_in 3997.46433118937 99 | # P_0_out 3984.67700709878 100 | # P_1_in 3984.67700709878 (same as P_2_in) 101 | # P_1_out 3958.0048 (same as P_2_out because symmetric) 102 | # Q_1_in 3.9925 (same as Q_1_out, Q_2_in, Q_2_out) 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /Tests/SystemTests/cases/tube_pressure.in: -------------------------------------------------------------------------------- 1 | MODEL results_tube_pressure_ 2 | 3 | NODE 0 0.0 0.0 0.0 4 | NODE 1 0.0 0.0 10.0 5 | 6 | SEGMENT seg0 0 10.0 50 0 1 1.0 1.0 0.0 MAT1 NONE 0.0 0 0 PRESSURE OUTLETDATA 7 | 8 | DATATABLE INLETDATA LIST 9 | 0.0 100.0 10 | 10.0 100.0 11 | ENDDATATABLE 12 | 13 | DATATABLE OUTLETDATA LIST 14 | 0.0 10000.0 15 | ENDDATATABLE 16 | 17 | SOLVEROPTIONS 0.001 1000 1000 2 INLETDATA FLOW 1.0e-8 1 1 18 | 19 | MATERIAL MAT1 OLUFSEN 1.06 0.04 0 2.0 1.0e15 -20 1e9 20 | 21 | OUTPUT TEXT 22 | 23 | # analytical solution 24 | 25 | # parameters 26 | # viscosity mu 0.04 27 | # vessel length L 10 28 | # vessel cross-section A 1 29 | # vessel radius r 0.5641895835 30 | # pressure outlet Pout 10000 31 | # prescribed inflow Q 100 32 | 33 | # reference solution 34 | # vessel resistance R1 = 8*mu*L*PI/A^2 = 10.05309649 35 | 36 | # results to be checked 37 | # pressure inlet Pin = Pout + Q*R1 = 11005.30965 38 | -------------------------------------------------------------------------------- /Tests/SystemTests/cases/tube_pressure_wave.in: -------------------------------------------------------------------------------- 1 | # tube with prescribed inlet pressure and outlet resistance (steady flow, analytical solution) 2 | 3 | MODEL results_tube_pressure_wave_ 4 | 5 | NODE 0 0.0 0.0 0.0 6 | NODE 1 0.0 0.0 10.0 7 | 8 | SEGMENT seg0 0 10.0 50 0 1 1.0 1.0 0.0 MAT1 NONE 0.0 0 0 RESISTANCE OUTLETDATA 9 | 10 | DATATABLE INLETDATA LIST 11 | 0.0 10000.0 12 | 10.0 10000.0 13 | ENDDATATABLE 14 | 15 | DATATABLE OUTLETDATA LIST 16 | 0.0 100.0 17 | ENDDATATABLE 18 | 19 | SOLVEROPTIONS 0.001 1000 1000 2 INLETDATA PRESSURE_WAVE 1.0e-8 1 1 20 | 21 | MATERIAL MAT1 OLUFSEN 1.06 0.04 0 2.0 1.0e15 -20 1e9 22 | 23 | OUTPUT TEXT 24 | 25 | # analytical solution 26 | 27 | # parameters 28 | # viscosity mu 0.04 29 | # vessel length L 10 30 | # vessel cross-section A 1 31 | # vessel radius r 0.5641895835 32 | # pressure inlet Pin 10000 33 | # resistance BC R2 100 34 | 35 | # reference solution 36 | # vessel resistance R1 = 8*mu*L*PI/A^2 = 10.05309649 37 | 38 | # results to be checked 39 | # flow Q = Pin / (R1 + R2) = 90.8652306835 40 | # pressure outlet Pout = Q*R2 = Pin * 1 / (1 + R1/R2) = 9086.52306835 41 | -------------------------------------------------------------------------------- /Tests/SystemTests/cases/tube_r.in: -------------------------------------------------------------------------------- 1 | MODEL results_tube_r_ 2 | 3 | NODE 0 0.0 0.0 0.0 4 | NODE 1 0.0 0.0 10.0 5 | 6 | SEGMENT seg0 0 10.0 50 0 1 1.0 1.0 0.0 MAT1 NONE 0.0 0 0 RESISTANCE OUTLETDATA 7 | 8 | DATATABLE INLETDATA LIST 9 | 0.0 100.0 10 | 10.0 100.0 11 | ENDDATATABLE 12 | 13 | DATATABLE OUTLETDATA LIST 14 | 0.0 100.0 15 | ENDDATATABLE 16 | 17 | SOLVEROPTIONS 0.001 1000 1000 2 INLETDATA FLOW 1.0e-8 1 1 18 | 19 | MATERIAL MAT1 OLUFSEN 1.06 0.04 0 2.0 1.0e15 -20 1e9 20 | 21 | OUTPUT TEXT 22 | 23 | # analytical solution 24 | 25 | # parameters 26 | # viscosity mu 0.04 27 | # vessel length L 10 28 | # vessel cross-section A 1 29 | # vessel radius r 0.5641895835 30 | # resistance BC R2 100 31 | # prescribed inflow Q 100 32 | 33 | # reference solution 34 | # vessel resistance R1 = 8*mu*L*PI/A^2 = 10.05309649 35 | 36 | # results to be checked 37 | # pressure inlet Pin = Q*(R1+R2) = 11005.30965 38 | # pressure outlet Pout = Q*R2 = 10000 39 | -------------------------------------------------------------------------------- /Tests/SystemTests/cases/tube_r_Pd.in: -------------------------------------------------------------------------------- 1 | MODEL results_tube_r_Pd_ 2 | 3 | NODE 0 0.0 0.0 0.0 4 | NODE 1 0.0 0.0 10.0 5 | 6 | SEGMENT seg0 0 10.0 50 0 1 1.0 1.0 0.0 MAT1 NONE 0.0 0 0 RESISTANCE OUTLETDATA 7 | 8 | DATATABLE INLETDATA LIST 9 | 0.0 100.0 10 | 10.0 100.0 11 | ENDDATATABLE 12 | 13 | # Distal pressure included in resistance, Pd = 1000.0 14 | DATATABLE OUTLETDATA LIST 15 | 0.0 100.0 16 | 0.0 1000.0 17 | ENDDATATABLE 18 | 19 | SOLVEROPTIONS 0.001 500 500 2 INLETDATA FLOW 1.0e-8 1 1 20 | 21 | MATERIAL MAT1 OLUFSEN 1.06 0.04 0 2.0 1.0e15 -20 1e9 22 | 23 | OUTPUT TEXT 24 | 25 | # analytical solution 26 | 27 | # parameters 28 | # viscosity mu 0.04 29 | # vessel length L 10 30 | # vessel cross-section A 1 31 | # vessel radius r 0.5641895835 32 | # resistance BC R2 100 33 | # prescribed inflow Q 100 34 | # distal pressure Pd 1000.0 35 | 36 | # reference solution 37 | # vessel resistance R1 = 8*mu*L*PI/A^2 = 10.05309649 38 | 39 | # results to be checked 40 | # pressure inlet Pin = Q*(R1+R2) = 12005.30965 41 | # pressure outlet Pout = Q*R2 = 11000 42 | -------------------------------------------------------------------------------- /Tests/SystemTests/cases/tube_r_stab.in: -------------------------------------------------------------------------------- 1 | MODEL results_tube_r_stab_ 2 | 3 | NODE 0 0.0 0.0 0.0 4 | NODE 1 0.0 0.0 10.0 5 | 6 | SEGMENT seg0 0 10.0 50 0 1 1.0 1.0 0.0 MAT1 NONE 0.0 0 0 RESISTANCE OUTLETDATA 7 | 8 | DATATABLE INLETDATA LIST 9 | 0.0 100.0 10 | 10.0 100.0 11 | ENDDATATABLE 12 | 13 | DATATABLE OUTLETDATA LIST 14 | 0.0 100.0 15 | ENDDATATABLE 16 | 17 | SOLVEROPTIONS 0.001 500 500 2 INLETDATA FLOW 1.0e-8 1 0 18 | 19 | MATERIAL MAT1 OLUFSEN 1.06 0.04 0 2.0 1.0e15 -20 1e9 20 | 21 | OUTPUT TEXT 22 | 23 | # analytical solution 24 | 25 | # parameters 26 | # viscosity mu 0.04 27 | # vessel length L 10 28 | # vessel cross-section A 1 29 | # vessel radius r 0.5641895835 30 | # resistance BC R2 100 31 | # prescribed inflow Q 100 32 | 33 | # reference solution 34 | # vessel resistance R1 = 8*mu*L*PI/A^2 = 10.05309649 35 | 36 | # results to be checked 37 | # pressure inlet Pin = Q*(R1+R2) = 11005.30965 38 | # pressure outlet Pout = Q*R2 = 10000 39 | -------------------------------------------------------------------------------- /Tests/SystemTests/cases/tube_rcr.in: -------------------------------------------------------------------------------- 1 | MODEL results_tube_rcr_ 2 | 3 | NODE 0 0.0 0.0 0.0 4 | NODE 1 0.0 0.0 10.0 5 | 6 | SEGMENT seg0 0 10.0 50 0 1 1.0 1.0 0.0 MAT1 NONE 0.0 0 0 RCR OUTLETDATA 7 | 8 | DATATABLE INLETDATA LIST 9 | 0.0 100.0 10 | 10.0 100.0 11 | ENDDATATABLE 12 | 13 | # emulating an R boundary condition for static testing 14 | # C = 0 15 | # R = 50 + 50 = 100 16 | DATATABLE OUTLETDATA LIST 17 | 0.0 50.0 18 | 0.0 0.001 19 | 0.0 50.0 20 | ENDDATATABLE 21 | 22 | SOLVEROPTIONS 0.001 1000 1000 2 INLETDATA FLOW 1.0e-8 1 1 23 | 24 | MATERIAL MAT1 OLUFSEN 1.06 0.04 0 2.0 1.0e15 -20 1e9 25 | 26 | OUTPUT TEXT 27 | 28 | # analytical solution 29 | 30 | # parameters 31 | # viscosity mu 0.04 32 | # vessel length L 10 33 | # vessel cross-section A 1 34 | # vessel radius r 0.5641895835 35 | # resistance BC R2 100 36 | # prescribed inflow Q 100 37 | 38 | # reference solution 39 | # vessel resistance R1 = 8*mu*L*PI/A^2 = 10.05309649 40 | 41 | # results to be checked 42 | # pressure inlet Pin = Q*(R1+R2) = 11005.30965 43 | # pressure outlet Pout = Q*R2 = 10000 44 | 45 | -------------------------------------------------------------------------------- /Tests/SystemTests/cases/tube_rcr_Pd.in: -------------------------------------------------------------------------------- 1 | MODEL results_tube_rcr_Pd_ 2 | 3 | NODE 0 0.0 0.0 0.0 4 | NODE 1 0.0 0.0 10.0 5 | 6 | SEGMENT seg0 0 10.0 50 0 1 1.0 1.0 0.0 MAT1 NONE 0.0 0 0 RCR OUTLETDATA 7 | 8 | DATATABLE INLETDATA LIST 9 | 0.0 100.0 10 | 10.0 100.0 11 | ENDDATATABLE 12 | 13 | # Includes distal pressure, Pd = 1000.0 14 | DATATABLE OUTLETDATA LIST 15 | 0.0 50.0 16 | 0.0 0.001 17 | 0.0 50.0 18 | 0.0 1000.0 19 | ENDDATATABLE 20 | 21 | SOLVEROPTIONS 0.001 100 1000 2 INLETDATA FLOW 1.0e-8 1 1 22 | 23 | MATERIAL MAT1 OLUFSEN 1.06 0.04 0 2.0 1.0e15 -20 1e9 24 | 25 | OUTPUT TEXT 26 | 27 | # analytical solution 28 | 29 | # parameters 30 | # viscosity mu 0.04 31 | # vessel length L 10 32 | # vessel cross-section A 1 33 | # vessel radius r 0.5641895835 34 | # resistance BC R2 100 35 | # prescribed inflow Q 100 36 | # distal pressure Pd 1000 37 | 38 | # reference solution 39 | # vessel resistance R1 = 8*mu*L*PI/A^2 = 10.05309649 40 | 41 | # results to be checked 42 | # pressure inlet Pin = Q*(R1+R2) = 12005.30965 43 | # pressure outlet Pout = Q*R2 = 11000 44 | -------------------------------------------------------------------------------- /Tests/SystemTests/cases/tube_stenosis_r.in: -------------------------------------------------------------------------------- 1 | MODEL results_tube_stenosis_r_ 2 | 3 | NODE 0 0.0 0.0 0.0 4 | NODE 1 0.0 0.0 10.0 5 | NODE 2 0.0 0.0 20.0 6 | NODE 3 0.0 0.0 30.0 7 | 8 | JOINT JOINT0 1 IN0 OUT0 9 | JOINTINLET IN0 1 0 10 | JOINTOUTLET OUT0 1 1 11 | 12 | JOINT JOINT1 2 IN1 OUT1 13 | JOINTINLET IN1 1 1 14 | JOINTOUTLET OUT1 1 2 15 | 16 | SEGMENT seg0 0 10.0 50 0 1 10.0 10.0 0.0 MAT1 NONE 0.0 0 0 NOBOUND NONE 17 | SEGMENT seg1 1 10.0 50 1 2 5.0 5.0 0.0 MAT1 STENOSIS 0.0 0 0 NOBOUND NONE 18 | SEGMENT seg2 2 10.0 50 2 3 10.0 10.0 0.0 MAT1 NONE 0.0 0 0 RESISTANCE OUTLETDATA 19 | 20 | DATATABLE INLETDATA LIST 21 | 0.0 100.0 22 | 10.0 100.0 23 | ENDDATATABLE 24 | 25 | DATATABLE OUTLETDATA LIST 26 | 0.0 100.0 27 | ENDDATATABLE 28 | 29 | SOLVEROPTIONS 0.001 1000 1000 2 INLETDATA FLOW 1.0e-8 1 1 30 | 31 | MATERIAL MAT1 OLUFSEN 1.06 0.04 0 2.0 1.0e15 -20 1e9 32 | 33 | OUTPUT TEXT 34 | 35 | # analytical solution 36 | 37 | # parameters 38 | # viscosity mu 0.04 39 | # vessel length L 10 40 | # vessel cross-section normal S0 10 41 | # vessel cross-section stenosis S1 5 42 | # resistance BC R_BC 100 43 | # prescribed inflow Q 100 44 | # loss factor Kt 1.52 45 | 46 | # derived parameters 47 | # vessel diameter normal D0 3.568248232 48 | # vessel diameter stenosis D1 2.523132522 49 | # kinematic visocity nu 0.03773584906 50 | 51 | # stenosis loss model 52 | # corrected length La = 0.83*L + 1.64*D1 = 12.43793734 53 | # loss factor Kv = 32*La/D0*(S0/S1)^2 = 446.1729889 54 | # Reynolds number Re0 = D0*Q/S0/nu 55 | # loss factor K = 2*(Kv/Re0 + Kt/2 * (S0/S1 - 1)^2) * (S1/S0)^2 56 | 57 | # reference solution 58 | # resistance normal vessels R1 = R3 = 8*mu*L*PI/A^2 = 10.05309649 59 | # pressure drop stenosis delta P = K/2*rho * (Q/S1)^2 = 130.5759137 60 | 61 | 62 | # results to be checked 63 | # pressure inlet Pin = Q*(R1+R3+R_BC) + delta P = 10150.68211 64 | # pressure outlet Pout = Q*R_BC = 10000 65 | -------------------------------------------------------------------------------- /Tests/SystemTests/conftest.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | import numpy as np 3 | 4 | from tempfile import TemporaryDirectory 5 | 6 | @pytest.fixture 7 | def tempdir(): 8 | """Temporary directory for test purposes.""" 9 | with TemporaryDirectory() as tempdir: 10 | yield tempdir 11 | 12 | def pytest_addoption(parser): 13 | parser.addoption("--relativeExePath", action="store") 14 | -------------------------------------------------------------------------------- /Tests/SystemTests/plots.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding=utf-8 3 | 4 | import pdb 5 | import os 6 | import subprocess 7 | import numpy as np 8 | from collections import defaultdict 9 | import matplotlib.pyplot as plt 10 | 11 | from run_tests import read_results_1d 12 | 13 | 14 | def run_local(name): 15 | """ 16 | Runs test case and returns results 17 | Args: 18 | name: name of test case 19 | Returns: 20 | dictionary res[result field][segment id][node, time step] 21 | """ 22 | # name of svOneDSolver executable 23 | solver = '_skyline' 24 | 25 | # path to this folder 26 | fpath = os.path.dirname(os.path.realpath(__file__)) 27 | 28 | # patth to executable 29 | build_dir = os.path.join(fpath, '..', 'build' + solver) 30 | exe = os.path.join(build_dir, 'bin', 'OneDSolver') 31 | 32 | # name of input file 33 | inp = os.path.join(fpath, name + '.in') 34 | 35 | # run simulation 36 | subprocess.check_output([exe, inp]) 37 | 38 | # return output 39 | return read_results_1d('.', 'results_' + name + '_seg*') 40 | 41 | 42 | def plot_tube_r(): 43 | """ 44 | Run tube_r.in and plot flow/pressure over the length of the tube 45 | """ 46 | # run simulation 47 | res = run_local('tube_r') 48 | 49 | # number of finite elements 50 | n_fem = 50 51 | 52 | # length of tube 53 | l_tube = 10 54 | 55 | # axial coordinate 56 | x = np.linspace(0, l_tube, n_fem + 1) 57 | 58 | # create plot 59 | fig, ax1 = plt.subplots(figsize=(8, 4), dpi=300) 60 | 61 | # plot pressure 62 | ax1.plot(x, res['pressure'][0], 'b-') 63 | ax1.set_xlabel('Axial coordinate') 64 | ax1.set_ylabel('Pressure') 65 | ax1.grid(True) 66 | 67 | # plot flow 68 | ax2 = ax1.twinx() 69 | ax2.plot(x, res['flow'][0], 'r-') 70 | ax2.set_ylabel('Flow') 71 | 72 | # save figure 73 | fig.savefig('tube_r_results.png', bbox_inches='tight') 74 | plt.close(fig) 75 | 76 | 77 | def plot_bifurcation_rcr(): 78 | """ 79 | Run bifurcation_rcr.in and plot flow/pressure over time at different locations 80 | """ 81 | # run simulation 82 | res = run_local('bifurcation_RCR') 83 | 84 | # number of exported time steps per cardiac cycle 85 | n_time = 100 86 | 87 | # time for one cardiac cycle 88 | t_max = 1.087 89 | 90 | # time vector 91 | t = np.linspace(0, t_max, n_time) 92 | 93 | # plot locations [segment, FEM node] and their names 94 | locations = [[0, 0], [0, 5], [0, -1], [1, 5], [1, -1]] 95 | 96 | # location names 97 | names = ['inlet', 'mid', 'junction', 'il mid', 'il outlet'] 98 | 99 | # fields to plot 100 | fields = ['flow', 'pressure'] 101 | 102 | # create plot 103 | fig, ax = plt.subplots(2, 1, figsize=(8, 8), dpi=300) 104 | 105 | # plot results in last cardiac cycle over time at selected locations 106 | for i, f in enumerate(fields): 107 | for k in locations: 108 | ax[i].plot(t, res[f][k[0]][k[1], -n_time:]) 109 | ax[i].set_xlabel('Time [s]') 110 | ax[i].set_ylabel(f.capitalize()) 111 | ax[i].legend(names) 112 | ax[i].grid(True) 113 | 114 | # save figure 115 | fig.savefig('bifurcation_rcr_results.png', bbox_inches='tight') 116 | plt.close(fig) 117 | 118 | 119 | def main(): 120 | """ 121 | Generate all plots 122 | """ 123 | plot_tube_r() 124 | plot_bifurcation_rcr() 125 | 126 | 127 | if __name__ == '__main__': 128 | main() 129 | -------------------------------------------------------------------------------- /Tests/UnitTests/ExampleTest.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | // This test verifies that the unit test framework is available and 6 | // that we can access files in the "TestFiles" directory. 7 | TEST(ExampleTest, ExampleTest) { 8 | const std::string filePath = "TestFiles/ExampleFile.txt"; 9 | std::ifstream file(filePath); 10 | 11 | // Verify the file was successfully opened 12 | ASSERT_TRUE(file.is_open()) << "Failed to open file: " << filePath; 13 | 14 | // Read the contents of the file 15 | std::string content; 16 | std::getline(file, content); 17 | 18 | // Verify that the file is not empty (example assumption that the file should contain some text) 19 | EXPECT_TRUE(content.find("Example text") != std::string::npos); 20 | 21 | // Close the file 22 | file.close(); 23 | } 24 | -------------------------------------------------------------------------------- /Tests/UnitTests/OptionsTestHelpers.hpp: -------------------------------------------------------------------------------- 1 | #include "cvOneDOptions.h" 2 | 3 | // Compares two sets of options using gtest macros 4 | void expectEqOptions(const cvOneD::options& actual, const cvOneD::options& expected); 5 | 6 | // Read the file contents to a string 7 | std::string readFileContents(const std::string& filePath); -------------------------------------------------------------------------------- /Tests/UnitTests/TestFiles/BifurcationR.in: -------------------------------------------------------------------------------- 1 | # Modelled from aortic bifurcation test case from 2 | # Xiao, N., Alastruey, J., Figueroa, C.A. A systematic comparison between 1-D and 3-D hemodynamics in compliant arterial models. Int J Numer Meth Bio, 2014; 30:204-231 3 | 4 | MODEL results_bifurcation_R_ 5 | 6 | NODE 0 0.0 0.0 0.0 7 | NODE 1 0.0 0.0 -8.6 8 | NODE 2 0.0 -3.25280917510326 -7.85297602634594 9 | NODE 3 0.0 3.25280917510326 -7.85297602634594 10 | 11 | JOINT JOINT1 1 INSEGS OUTSEGS 12 | JOINTINLET INSEGS 1 0 13 | JOINTOUTLET OUTSEGS 2 1 2 14 | 15 | SEGMENT seg0 0 8.6 50 0 1 2.32352192659501 2.32352192659501 0.0 MAT1 NONE 0.0 0 0 NOBOUND NONE 16 | SEGMENT seg1 1 8.5 50 1 3 1.13097335529233 1.13097335529233 0.0 MAT1 NONE 0.0 0 0 RESISTANCE R_VALS 17 | SEGMENT seg2 2 8.5 50 1 2 1.13097335529233 1.13097335529233 0.0 MAT1 NONE 0.0 0 0 RESISTANCE R_VALS 18 | 19 | DATATABLE R_VALS LIST 20 | 0.0 991.36 21 | ENDDATATABLE 22 | 23 | DATATABLE STEADY_FLOW LIST 24 | 0.0 7.985 25 | 1.0 7.985 26 | ENDDATATABLE 27 | 28 | DATATABLE PULS_FLOW LIST 29 | 0.0 0.0 30 | 0.019668108360095 -4.11549971450822 31 | 0.055247073448669 -7.16517105402019 32 | 0.089913757381125 -1.16130916560675 33 | 0.113633067440174 9.27967911020849 34 | 0.133703252874754 20.4428655623545 35 | 0.150124313684865 32.8883708080991 36 | 0.162896249870507 43.9606301469767 37 | 0.173843623743914 54.6495650354764 38 | 0.186615559929556 67.3593157640345 39 | 0.204861183051901 79.6320314281343 40 | 0.234784004972547 86.0097422945109 41 | 0.26872086398011 78.7468811589053 42 | 0.294264736351393 64.7319679994526 43 | 0.314334921785973 52.023318573387 44 | 0.32893142028385 41.4040199668672 45 | 0.34535248109396 29.7287601931208 46 | 0.363598104216306 17.3938305987427 47 | 0.380019165026417 6.42196693062957 48 | 0.396440225836527 -5.11194051566898 49 | 0.422389556499419 -18.901261909892 50 | 0.455347523345814 -23.8602212809087 51 | 0.496182965572016 -18.2411583475954 52 | 0.533485128399922 -10.4792705793446 53 | 0.575247332435512 -4.00466780439001 54 | 0.640931575675956 -2.79835885098868 55 | 0.682440368279291 -5.30400645008189 56 | 0.726077816913567 -8.52809746163143 57 | 0.762721110017611 -9.03919130533637 58 | 0.802405340308712 -7.30944473123762 59 | 0.846498929521047 -5.55578067364513 60 | 0.885944229033165 -5.87317544184486 61 | 0.925563296384544 -7.14939949266443 62 | 0.968258054490832 -6.10169723438909 63 | 1.00949316274733 -4.10721983893183 64 | 1.05237037708484 -3.31554531122748 65 | 1.087 -1.77083891076532 66 | ENDDATATABLE 67 | 68 | 69 | # Ref Pressure 1333.22*85 where 85 is in mmHg 70 | # Rigid for now, but can be elastic with the following parameters: 71 | # h_0 = 1.032mm, E_0 = 500 kPa, h_1 = h_2 = 0.72 mm, E_1 = E_2 = 700 kPa 72 | MATERIAL MAT1 OLUFSEN 1.06 0.04 0 2.0 1.0e15 -20 1e9 73 | 74 | SOLVEROPTIONS 0.001087 50 1000 2 STEADY_FLOW FLOW 1.0e-6 1 1 75 | 76 | OUTPUT TEXT 77 | 78 | 79 | # analytical solution 80 | 81 | # parameters 82 | # viscosity mu 0.04 83 | # seg0 length L_0 8.6 84 | # seg0 radius r_0 0.86 85 | # seg1 length L_1 8.5 (same as seg2 length) 86 | # seg1 radius r_1 0.6 (same as seg2 radius) 87 | # resistance BC R 991.36 88 | # steady Inlet Flow Q_0 7.985 89 | # Distal pressure Pd 0 90 | 91 | # reference solution 92 | # assumes no pressure losses at bifurcation and purely parallel resistances 93 | # total 1D model resistance Rtot = (R_0 + 0.5*(R_2 + R) 94 | # Pressure at junction P_0_out = P_1_in = P_2_in 95 | 96 | # Results to be checked 97 | # P_0_in 3997.46433118937 98 | # P_0_out 3984.67700709878 99 | # P_1_in 3984.67700709878 (same as P_2_in) 100 | # P_1_out 3958.0048 (same as P_2_out because symmetric) 101 | # Q_1_in 3.9925 (same as Q_1_out) 102 | 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /Tests/UnitTests/TestFiles/ExampleFile.txt: -------------------------------------------------------------------------------- 1 | Example text -------------------------------------------------------------------------------- /cmake/External_PCRE.cmake: -------------------------------------------------------------------------------- 1 | # Make sure this file is included only once 2 | get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) 3 | if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) 4 | return() 5 | endif() 6 | set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) 7 | 8 | # Sanity checks 9 | if(DEFINED PCRE_DIR AND NOT EXISTS ${PCRE_DIR}) 10 | message(FATAL_ERROR "PCRE_DIR variable is defined but corresponds to non-existing directory") 11 | endif() 12 | 13 | # Set dependency list 14 | set(PCRE_DEPENDENCIES "") 15 | 16 | if(NOT PCRE_DIR) 17 | 18 | # PCRE (Perl Compatible Regular Expressions) 19 | SET(PCRE_TARGET_VERSION 8.12) 20 | SET(PCRE_DOWNLOAD_SOURCE_HASH "fa69e4c5d8971544acd71d1f10d59193") 21 | 22 | # Follow the standard EP_PREFIX locations 23 | SET(PCRE_PREFIX ${CMAKE_BINARY_DIR}/external) 24 | SET(PCRE_DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/external/PCRE-prefix) 25 | SET(PCRE_BINARY_DIR ${CMAKE_BINARY_DIR}/external/PCRE-prefix/src/PCRE-build) 26 | SET(PCRE_SOURCE_DIR ${CMAKE_BINARY_DIR}/external/PCRE-prefix/src/PCRE) 27 | SET(PCRE_INSTALL_DIR ${CMAKE_BINARY_DIR}/external/PCRE) 28 | 29 | CONFIGURE_FILE( 30 | ${CMAKE_MODULE_PATH}/pcre_configure_step.cmake.in 31 | ${CMAKE_BINARY_DIR}/external/pcre_configure_step.cmake 32 | @ONLY) 33 | 34 | SET( pcre_CONFIGURE_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/external/pcre_configure_step.cmake ) 35 | 36 | ExternalProject_add(PCRE 37 | URL http://midas3.kitware.com/midas/api/rest?method=midas.bitstream.download&checksum=${PCRE_DOWNLOAD_SOURCE_HASH}&name=pcre-${PCRE_TARGET_VERSION}.tar.gz 38 | URL_MD5 "${PCRE_DOWNLOAD_SOURCE_HASH}" 39 | CONFIGURE_COMMAND ${pcre_CONFIGURE_COMMAND} 40 | DEPENDS "${PCRE_DEPENDENCIES}" 41 | PREFIX ${PCRE_PREFIX} 42 | DOWNLOAD_DIR ${PCRE_DOWNLOAD_DIR} 43 | BINARY_DIR ${PCRE_BINARY_DIR} 44 | SOURCE_DIR ${PCRE_SOURCE_DIR} 45 | INSTALL_DIR ${PCRE_INSTALL_DIR} 46 | ) 47 | endif(NOT PCRE_DIR) -------------------------------------------------------------------------------- /cmake/FindSphinx.cmake: -------------------------------------------------------------------------------- 1 | find_program(SPHINX_EXECUTABLE NAMES sphinx-build 2 | HINTS 3 | $ENV{SPHINX_DIR} 4 | PATH_SUFFIXES bin 5 | DOC "Sphinx documentation generator" 6 | ) 7 | 8 | include(FindPackageHandleStandardArgs) 9 | 10 | find_package_handle_standard_args(Sphinx DEFAULT_MSG 11 | SPHINX_EXECUTABLE 12 | ) 13 | 14 | mark_as_advanced(SPHINX_EXECUTABLE) -------------------------------------------------------------------------------- /cmake/installSwig.cmake: -------------------------------------------------------------------------------- 1 | # Include CMake External Project Module 2 | INCLUDE(ExternalProject) 3 | 4 | SET ( WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/external ) 5 | 6 | # Make sure this file is included only once 7 | #GET_FILENAME_COMPONENT( CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE ) 8 | #if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) 9 | # RETURN() 10 | #ENDIF() 11 | 12 | #SET(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) 13 | 14 | # Sanity checks 15 | IF(DEFINED SWIG_DIR AND NOT EXISTS ${SWIG_DIR}) 16 | MESSAGE(FATAL_ERROR "Swig_DIR variable is defined but corresponds to non-existing directory") 17 | ENDIF() 18 | 19 | IF(NOT SWIG_DIR) 20 | 21 | SET(SWIG_TARGET_VERSION 2.0.12-1) 22 | SET(SWIG_DOWNLOAD_SOURCE_HASH "44af22bffb53d1795b0f5cb3bff5eb1a") 23 | SET(SWIG_DOWNLOAD_WIN_HASH "439bc49355dc76490b3fe0dffac2774d") 24 | 25 | 26 | IF(WIN32) 27 | # binary SWIG for windows 28 | set(swig_source_dir ${CMAKE_CURRENT_BINARY_DIR}/swigwin-${SWIG_TARGET_VERSION}) 29 | 30 | # swig.exe available as pre-built binary on Windows: 31 | ExternalProject_Add(SWIG 32 | URL http://midas3.kitware.com/midas/api/rest?method=midas.bitstream.download&checksum=${SWIG_DOWNLOAD_WIN_HASH}&name=swigwin-${SWIG_TARGET_VERSION}.zip 33 | URL_MD5 ${SWIG_DOWNLOAD_WIN_HASH} 34 | SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/swigwin-${SWIG_TARGET_VERSION} 35 | CONFIGURE_COMMAND "" 36 | BUILD_COMMAND "" 37 | INSTALL_COMMAND "" 38 | ) 39 | 40 | set(SWIG_DIR ${CMAKE_CURRENT_BINARY_DIR}/swigwin-${SWIG_TARGET_VERSION}) # path specified as source in ep 41 | set(SWIG_EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/swigwin-${SWIG_TARGET_VERSION}/swig.exe) 42 | 43 | else() 44 | # compiled SWIG for others 45 | 46 | # Set dependency list 47 | SET(SWIG_DEPENDENCIES "PCRE") 48 | 49 | # Install PCRE if needed 50 | # PCRE (Perl Compatible Regular Expressions) 51 | INCLUDE(External_PCRE) 52 | 53 | # Install SWIG 54 | 55 | # swig uses bison find it by cmake and pass it down 56 | FIND_PACKAGE(BISON) 57 | SET( BISON_FLAGS "" CACHE STRING "Flags used by bison" ) 58 | mark_as_advanced( BISON_FLAGS ) 59 | 60 | # follow the standard EP_PREFIX locations 61 | SET(SWIG_PREFIX ${CMAKE_BINARY_DIR}/external) 62 | SET(SWIG_BINARY_DIR ${CMAKE_BINARY_DIR}/external/Swig-prefix/src/Swig-build) 63 | SET(SWIG_SOURCE_DIR ${CMAKE_BINARY_DIR}/external/Swig-prefix/src/Swig) 64 | SET(SWIG_INSTALL_DIR ${CMAKE_BINARY_DIR}/external/Swig) 65 | 66 | # configure step 67 | configure_file( 68 | ${CMAKE_MODULE_PATH}/swig_configure_step.cmake.in 69 | ${CMAKE_BINARY_DIR}/external/swig_configure_step.cmake 70 | @ONLY) 71 | SET(SWIG_CONFIGURE_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/external/swig_configure_step.cmake) 72 | 73 | 74 | ExternalProject_add(SWIG 75 | URL http://midas3.kitware.com/midas/api/rest?method=midas.bitstream.download&checksum=${SWIG_DOWNLOAD_SOURCE_HASH}&name=swig-${SWIG_TARGET_VERSION}.tar.gz 76 | URL_MD5 ${SWIG_DOWNLOAD_SOURCE_HASH} 77 | CONFIGURE_COMMAND ${SWIG_CONFIGURE_COMMAND} 78 | DEPENDS "${Swig_DEPENDENCIES}" 79 | PREFIX ${SWIG_PREFIX} 80 | BINARY_DIR ${SWIG_BINARY_DIR} 81 | SOURCE_DIR ${SWIG_SOURCE_DIR} 82 | INSTALL_DIR ${SWIG_INSTALL_DIR} 83 | ) 84 | 85 | set(SWIG_DIR ${SWIG_INSTALL_DIR}/share/swig/${SWIG_TARGET_VERSION}) 86 | set(SWIG_EXECUTABLE ${SWIG_INSTALL_DIR}/bin/swig) 87 | 88 | endif() 89 | endif(NOT SWIG_DIR) -------------------------------------------------------------------------------- /cmake/pcre_configure_step.cmake.in: -------------------------------------------------------------------------------- 1 | # Set the important envirimental variables that auto-conf uses to 2 | # configure, mostly these are passed from the CMake 3 | # configuration. Others are just explicitly passed from the 4 | # enviroment. If there is a problem with them in the future they can 5 | # be addressed in CMake with the same structure. 6 | 7 | set(ENV{CC} "@CMAKE_C_COMPILER@ @CMAKE_C_COMPILER_ARG1@") 8 | set(ENV{CFLAGS} "@CMAKE_C_FLAGS@ @CMAKE_C_FLAGS_RELEASE@") 9 | set(ENV{LDFLAGS} "@CMAKE_LINKER_FLAGS@ @CMAKE_LINKER_FLAGS_RELEASE@") 10 | 11 | set(ENV{LIBS} "$ENV{LIBS}") 12 | 13 | set(ENV{CPP} "$ENV{CPP}") 14 | set(ENV{CPPFLAGS} "$ENV{CPPFLAGS}") 15 | set(ENV{CXXPP} "$ENV{CXXPP}") 16 | 17 | set(ENV{CXX} "@CMAKE_CXX_COMPILER@ @CMAKE_CXX_COMPILER_ARG1@") 18 | set(ENV{CXXFLAGS} "@CMAKE_CXX_FLAGS@ @CMAKE_CXX_FLAGS_RELEASE@") 19 | 20 | 21 | set(ENV{YACC} "@BISON_EXECUTABLE@" ) 22 | set(ENV{YFLAGS} "@BISON_FLAGS@" ) 23 | 24 | execute_process( 25 | COMMAND sh @PCRE_SOURCE_DIR@/configure --prefix=@PCRE_INSTALL_DIR@ --disable-shared 26 | WORKING_DIRECTORY @PCRE_BINARY_DIR@ 27 | ) -------------------------------------------------------------------------------- /cmake/swig_configure_step.cmake.in: -------------------------------------------------------------------------------- 1 | # Set the important envirimental variables that auto-conf uses to 2 | # configure, mostly these are passed from the CMake 3 | # configuration. Others are just explicitly passed from the 4 | # enviroment. If there is a problem with them in the future they can 5 | # be addressed in CMake with the same structure. 6 | 7 | set(ENV{CC} "@CMAKE_C_COMPILER@ @CMAKE_C_COMPILER_ARG1@") 8 | set(ENV{CFLAGS} "@CMAKE_C_FLAGS@ @CMAKE_C_FLAGS_RELEASE@") 9 | set(ENV{LDFLAGS} "@CMAKE_LINKER_FLAGS@ @CMAKE_LINKER_FLAGS_RELEASE@") 10 | 11 | set(ENV{LIBS} "$ENV{LIBS}") 12 | set(ENV{CPP} "$ENV{CPP}") 13 | set(ENV{CPPFLAGS} "$ENV{CPPFLAGS}") 14 | 15 | set(ENV{CXX} "@CMAKE_CXX_COMPILER@ @CMAKE_CXX_COMPILER_ARG1@") 16 | set(ENV{CXXFLAGS} "@CMAKE_CXX_FLAGS@ @CMAKE_CXX_FLAGS_RELEASE@") 17 | 18 | set(ENV{YACC} "@BISON_EXECUTABLE@" ) 19 | set(ENV{YFLAGS} "@BISON_FLAGS@" ) 20 | 21 | execute_process( 22 | COMMAND sh @SWIG_SOURCE_DIR@/configure 23 | --prefix=@SWIG_INSTALL_DIR@ 24 | --with-pcre-prefix=@PCRE_INSTALL_DIR@ 25 | --without-octave 26 | --with-python=@PYTHON_EXECUTABLE@ 27 | WORKING_DIRECTORY @SWIG_BINARY_DIR@ 28 | ) -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | build/ -------------------------------------------------------------------------------- /docs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(svOneDSolver) 2 | 3 | SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}") 4 | 5 | FIND_PACKAGE(Sphinx REQUIRED) 6 | 7 | IF(NOT DEFINED SPHINX_THEME) 8 | SET(SPHINX_THEME default) 9 | ENDIF() 10 | 11 | IF(NOT DEFINED SPHINX_THEME_DIR) 12 | SET(SPHINX_THEME_DIR) 13 | ENDIF() 14 | 15 | # configured documentation tools and intermediate build results 16 | SET(BINARY_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}") 17 | 18 | # Sphinx cache with pickled ReST documents 19 | SET(SPHINX_CACHE_DIR "${CMAKE_CURRENT_BINARY_DIR}/.doctrees") 20 | 21 | # HTML output directory 22 | SET(SPHINX_HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/html") 23 | 24 | FILE(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/_static") 25 | 26 | CONFIGURE_FILE( 27 | "${CMAKE_CURRENT_SOURCE_DIR}/source/conf.py.in" 28 | "${BINARY_BUILD_DIR}/conf.py" 29 | @ONLY) 30 | 31 | ADD_CUSTOM_TARGET(docs 32 | ${SPHINX_EXECUTABLE} 33 | -v -b html 34 | -c "${BINARY_BUILD_DIR}" 35 | -d "${SPHINX_CACHE_DIR}" 36 | "${CMAKE_CURRENT_SOURCE_DIR}/source" 37 | "${SPHINX_HTML_DIR}" 38 | COMMENT "Building HTML documentation with Sphinx") 39 | -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/__init__.py: -------------------------------------------------------------------------------- 1 | """Sphinx ReadTheDocs theme. 2 | 3 | From https://github.com/ryan-roemer/sphinx-bootstrap-theme. 4 | 5 | """ 6 | from os import path 7 | 8 | 9 | __version__ = '0.4.3.dev0' 10 | __version_full__ = __version__ 11 | 12 | 13 | def get_html_theme_path(): 14 | """Return list of HTML theme paths.""" 15 | cur_dir = path.abspath(path.dirname(path.dirname(__file__))) 16 | return cur_dir 17 | 18 | 19 | # See http://www.sphinx-doc.org/en/stable/theming.html#distribute-your-theme-as-a-python-package 20 | def setup(app): 21 | app.add_html_theme('sphinx_rtd_theme', path.abspath(path.dirname(__file__))) 22 | -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/footer.html: -------------------------------------------------------------------------------- 1 |
2 | {% if (theme_prev_next_buttons_location == 'bottom' or theme_prev_next_buttons_location == 'both') and (next or prev) %} 3 | 11 | {% endif %} 12 | 13 |
14 | 15 |
16 |

17 | {%- if show_copyright %} 18 | {%- if hasdoc('copyright') %} 19 | {% trans path=pathto('copyright'), copyright=copyright|e %}© Copyright {{ copyright }}{% endtrans %} 20 | {%- else %} 21 | {% trans copyright=copyright|e %}© Copyright {{ copyright }}{% endtrans %} 22 | {%- endif %} 23 | {%- endif %} 24 | 25 | {%- if build_id and build_url %} 26 | {% trans build_url=build_url, build_id=build_id %} 27 | 28 | Build 29 | {{ build_id }}. 30 | 31 | {% endtrans %} 32 | {%- elif commit %} 33 | {% trans commit=commit %} 34 | 35 | Revision {{ commit }}. 36 | 37 | {% endtrans %} 38 | {%- elif last_updated %} 39 | 40 | {% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %} 41 | 42 | {%- endif %} 43 | 44 |

45 |
46 | 47 | {%- if show_sphinx %} 48 | {% trans %}Built with Sphinx using a theme provided by Read the Docs{% endtrans %}. 49 | {%- endif %} 50 | 51 | {%- block extrafooter %} {% endblock %} 52 | 53 |
54 | 55 | -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/search.html: -------------------------------------------------------------------------------- 1 | {# 2 | basic/search.html 3 | ~~~~~~~~~~~~~~~~~ 4 | 5 | Template for the search page. 6 | 7 | :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS. 8 | :license: BSD, see LICENSE for details. 9 | #} 10 | {%- extends "layout.html" %} 11 | {% set title = _('Search') %} 12 | {%- block scripts %} 13 | {{ super() }} 14 | 15 | {%- endblock %} 16 | {% block footer %} 17 | 20 | {# this is used when loading the search index using $.ajax fails, 21 | such as on Chrome for documents on localhost #} 22 | 23 | {{ super() }} 24 | {% endblock %} 25 | {% block body %} 26 | 34 | 35 | {% if search_performed %} 36 |

{{ _('Search Results') }}

37 | {% if not search_results %} 38 |

{{ _('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.') }}

39 | {% endif %} 40 | {% endif %} 41 |
42 | {% if search_results %} 43 |
    44 | {% for href, caption, context in search_results %} 45 |
  • 46 | {{ caption }} 47 |

    {{ context|e }}

    48 |
  • 49 | {% endfor %} 50 |
51 | {% endif %} 52 |
53 | {% endblock %} 54 | -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/searchbox.html: -------------------------------------------------------------------------------- 1 | {%- if builder != 'singlehtml' %} 2 |
3 |
4 | 5 | 6 | 7 |
8 |
9 | {%- endif %} 10 | -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/static/css/badge_only.css: -------------------------------------------------------------------------------- 1 | .fa:before{-webkit-font-smoothing:antialiased}.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-weight:normal;font-style:normal;src:url("../fonts/fontawesome-webfont.eot");src:url("../fonts/fontawesome-webfont.eot?#iefix") format("embedded-opentype"),url("../fonts/fontawesome-webfont.woff") format("woff"),url("../fonts/fontawesome-webfont.ttf") format("truetype"),url("../fonts/fontawesome-webfont.svg#FontAwesome") format("svg")}.fa:before{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:normal;line-height:1;text-decoration:inherit}a .fa{display:inline-block;text-decoration:inherit}li .fa{display:inline-block}li .fa-large:before,li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-0.8em}ul.fas li .fa{width:.8em}ul.fas li .fa-large:before,ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before{content:""}.icon-book:before{content:""}.fa-caret-down:before{content:""}.icon-caret-down:before{content:""}.fa-caret-up:before{content:""}.icon-caret-up:before{content:""}.fa-caret-left:before{content:""}.icon-caret-left:before{content:""}.fa-caret-right:before{content:""}.icon-caret-right:before{content:""}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;z-index:400}.rst-versions a{color:#2980B9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27AE60;*zoom:1}.rst-versions .rst-current-version:before,.rst-versions .rst-current-version:after{display:table;content:""}.rst-versions .rst-current-version:after{clear:both}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book{float:left}.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#E74C3C;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#F1C40F;color:#000}.rst-versions.shift-up{height:auto;max-height:100%;overflow-y:scroll}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:gray;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:solid 1px #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px;max-height:90%}.rst-versions.rst-badge .icon-book{float:none}.rst-versions.rst-badge .fa-book{float:none}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book{float:left}.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge .rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width: 768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}} 2 | -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/static/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimVascular/svOneDSolver/66b31b4221b8dc9c04a767ed48e6a5367f63a499/docs/_themes/sphinx_rtd_theme/static/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/static/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimVascular/svOneDSolver/66b31b4221b8dc9c04a767ed48e6a5367f63a499/docs/_themes/sphinx_rtd_theme/static/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/static/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimVascular/svOneDSolver/66b31b4221b8dc9c04a767ed48e6a5367f63a499/docs/_themes/sphinx_rtd_theme/static/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/static/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimVascular/svOneDSolver/66b31b4221b8dc9c04a767ed48e6a5367f63a499/docs/_themes/sphinx_rtd_theme/static/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/static/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimVascular/svOneDSolver/66b31b4221b8dc9c04a767ed48e6a5367f63a499/docs/_themes/sphinx_rtd_theme/static/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/theme.conf: -------------------------------------------------------------------------------- 1 | [theme] 2 | inherit = basic 3 | stylesheet = css/theme.css 4 | pygments_style = default 5 | 6 | [options] 7 | canonical_url = 8 | analytics_id = 9 | collapse_navigation = True 10 | sticky_navigation = True 11 | navigation_depth = 4 12 | includehidden = True 13 | titles_only = 14 | logo_only = 15 | display_version = True 16 | prev_next_buttons_location = bottom 17 | style_external_links = False 18 | style_nav_header_background = -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/versions.html: -------------------------------------------------------------------------------- 1 | {% if READTHEDOCS %} 2 | {# Add rst-badge after rst-versions for small badge style. #} 3 |
4 | 5 | Read the Docs 6 | v: {{ current_version }} 7 | 8 | 9 |
10 |
11 |
{{ _('Versions') }}
12 | {% for slug, url in versions %} 13 |
{{ slug }}
14 | {% endfor %} 15 |
16 |
17 |
{{ _('Downloads') }}
18 | {% for type, url in downloads %} 19 |
{{ type }}
20 | {% endfor %} 21 |
22 |
23 |
{{ _('On Read the Docs') }}
24 |
25 | {{ _('Project Home') }} 26 |
27 |
28 | {{ _('Builds') }} 29 |
30 |
31 |
32 | {% trans %}Free document hosting provided by Read the Docs.{% endtrans %} 33 | 34 |
35 |
36 | {% endif %} 37 | 38 | -------------------------------------------------------------------------------- /docs/source/content/Images/bifurcation_rcr_results.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimVascular/svOneDSolver/66b31b4221b8dc9c04a767ed48e6a5367f63a499/docs/source/content/Images/bifurcation_rcr_results.png -------------------------------------------------------------------------------- /docs/source/content/Images/tube_r_results.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimVascular/svOneDSolver/66b31b4221b8dc9c04a767ed48e6a5367f63a499/docs/source/content/Images/tube_r_results.png -------------------------------------------------------------------------------- /docs/source/content/Images/tube_r_schematic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimVascular/svOneDSolver/66b31b4221b8dc9c04a767ed48e6a5367f63a499/docs/source/content/Images/tube_r_schematic.png -------------------------------------------------------------------------------- /docs/source/content/about.rst: -------------------------------------------------------------------------------- 1 | About oneDSolver 2 | ================ 3 | 4 | oneDSolver is a c++ code that solves for blood pressure and flow in deformable 1D hemodynamic networks. 5 | 6 | It is the result of contributions from various members of the Taylor's lab at Stanford. 7 | Some of the main contributors are I. Vignon-Clementel, N. Wilson, J. Wan, B. Steele, G.R.Feijoo, S.A.Spicer, S.Strohband,T.J.R. Hughes and C.Taylor. 8 | 9 | The one-dimensional equations for the flow of a Newtonian, incompressible fluid in a deforming, elastic domain consist of the continuity equation, a single axial momentum balance equation, a constitutive equation, and suitable initial and boundary conditions. The governing equations are derived in a general form by Hughes [2]_ and Hughes and Lubliner [1]_. 10 | 11 | References 12 | ---------- 13 | 14 | .. [1] T.J.R. Hughes and J. Lubliner, **On the One-Dimensional Theory of Blood Flow in the Larger Vessels** , `Mathematical Biosciences` , 18(1-2) (1973), 161-170. 15 | .. [2] T.J.R. Hughes, **A Study of the One-Dimensional Theory of Arterial Pulse Propagation**, 1974, `U.C. Berkeley`, Ph.D. Thesis. 16 | 17 | 18 | -------------------------------------------------------------------------------- /docs/source/content/test_bifurcation_rcr.rst: -------------------------------------------------------------------------------- 1 | Bifurcation with RCR boundary conditions 2 | ======================================== 3 | 4 | 5 | This example is documented in the test case :code:`test/bifurcation_RCR.in`. The geometry and images for this example are taken from [1]_. The geometry consists of a symmetric bifurcation with RCR boundary conditions. All three branches have a constant diameter, the inflow is pulsatile. The parameters are taken from Table III [1]_). 6 | 7 | The test case is only run for 2 cycles. To reach a periodic state, at least 10 cycles are required: 8 | 9 | .. image:: Images/bifurcation_rcr_results.png 10 | 11 | The results are similar to the ones in Figure 11 [1]_. 12 | 13 | .. literalinclude:: ../../../test/bifurcation_RCR.in 14 | 15 | References 16 | ---------- 17 | 18 | .. [1] N. Xiao, J. Alastruey, and C. Alberto Figueroa (2014), A systematic comparison between 1‐D and 3‐D hemodynamics in compliant arterial models. Int. J. Numer. Meth. Biomed. Engng., 30: 204-231. doi:10.1002/cnm.2598 19 | -------------------------------------------------------------------------------- /docs/source/content/test_tube_r.rst: -------------------------------------------------------------------------------- 1 | Tube with resistance boundary condition 2 | ======================================= 3 | 4 | .. image:: Images/tube_r_schematic.png 5 | 6 | This example is documented in the test case :code:`test/tuber_r.in`. It consists of a tube (length :math:`L=10`, constant cross-section :math:`A=1`), constant inflow boundary condition (flow :math:`Q=100`), resistance outlet boundary condition (resistance :math:`R_2=100`), Poiseuille flow (profile exponent = 2.0), and quasi-rigid wall (i.e. wall stiffness :math:`\to\infty`). The simulation runs for 1000 time steps to achieve a steady state. 7 | 8 | .. literalinclude:: ../../../test/tube_r.in 9 | 10 | 11 | The tube resistance can be analytically calculated as 12 | 13 | .. math:: 14 | R_1 = \frac{8\mu l \pi}{A^2} \approx 10.05309649, 15 | 16 | with viscosity :math:`\mu=0.04`. The pressures at inlet and outlet :math:`P_\text{in}` and :math:`P_\text{out}`, respectively, can then be calculated as 17 | 18 | .. math:: 19 | P_\text{in} &= Q \cdot (R_1 + R_2) \approx 11005.309649 \\ 20 | P_\text{out} &= Q \cdot R_2 = 10000.0 21 | 22 | The following plot shows that pressure (blue) drops linearly and flow (red) is constant along the tube. 23 | 24 | .. image:: Images/tube_r_results.png 25 | -------------------------------------------------------------------------------- /docs/source/content/tutorials.rst: -------------------------------------------------------------------------------- 1 | Tutorials 2 | ========= 3 | 4 | Contents: 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | 9 | test_tube_r 10 | test_bifurcation_rcr.rst 11 | -------------------------------------------------------------------------------- /docs/source/content/userGuide.rst: -------------------------------------------------------------------------------- 1 | User Guide and FAQs 2 | ================ 3 | 4 | What are nodes, segments and joints? 5 | ^^^^^^^^^^^^ 6 | * A *node* specifies the coordinates in (x,y,z) space of the connection between vessel segments. This corresponds to the location of the vessel centerline of the 3D model. 7 | * A *segment* is a straight length of vasculature with tapered circular cross section. It connects different cross sections of the model and is symmetric across the xy plane. 8 | * A *joint* is a connection between segments that ensures a unique pressure value and mass continuity. Joints can be within a single branch or at bifurcations of multiple branches. 9 | 10 | 11 | How to select a time step? 12 | ^^^^^ 13 | The size of your time step is influenced by several factors. For a straight, smooth, well-behaved model, a larger time step can be used. Additionally, for more stiff vessels (higher elastic modulus), a larger time step can be used. The more compliance is present in your model or the presence of a larger number of branches or very small branches will likely necessitate smaller time steps. Starting with a time step of 0.01 and decreaing by a factor of 1/2 until your model attains convergence is 14 | 15 | 16 | How to select the number element quadrature points? 17 | ^^^^^^^^^^ 18 | This number generally does not need to be changed and can remain at its default value of 4. 19 | 20 | 21 | How to select the number of elements per segment? 22 | ^^^^^^^^^^^^ 23 | For the most complete studies, a mesh convergence can be performed to ensure the proper number of elements per segment are used. If this is not desired, generally 10-25 elements per segment is sufficient. If you have very large segements, you will likely want to increase this to 50-150 elements. You can start at the smaller number of elements per segment and increase if you experience solver errors (see below). 24 | 25 | 26 | Solver errors 27 | ^^^^^^^^^^^^^^ 28 | If you receive an error while running a simulation, most commonly this can be solved by decreasing the time step (work in factors of 1/2) and increasing the number of elements per segment (work in factors of 2). 29 | 30 | A common error, which can occur when there is a large difference in the inlet and outlet areas of a segment, is ``outlet areas going negative``. 31 | 32 | If this isn't working, then the geometry of the 1D model may need to be altered. This could involve adding additional segments to make the change in inlet and outlet area of the segments more gradual. It could also included truncating the model to remove branches or sections of branches with very small radii. 33 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | .. testProject documentation master file, created by 2 | sphinx-quickstart on Sat Aug 15 10:01:31 2015. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to oneDSolver's documentation! 7 | ======================================= 8 | 9 | Contents: 10 | 11 | .. toctree:: 12 | :maxdepth: 2 13 | 14 | content/about 15 | content/installation 16 | content/theory 17 | content/inputFileGuide 18 | content/userGuide 19 | content/tutorials 20 | content/pythonScripting 21 | 22 | Indices and tables 23 | ================== 24 | 25 | * :ref:`genindex` 26 | * :ref:`modindex` 27 | * :ref:`search` 28 | 29 | -------------------------------------------------------------------------------- /py/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc -------------------------------------------------------------------------------- /py/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # BUILD PYTHON MODULES 2 | FIND_PACKAGE(SWIG) 3 | 4 | IF(SWIG_FOUND) 5 | 6 | INCLUDE(UseSWIG) 7 | 8 | FIND_PACKAGE(PythonLibs 3) 9 | 10 | MESSAGE(STATUS "Python Library Version: ${PYTHONLIBS_VERSION_STRING}") 11 | 12 | INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) 13 | 14 | INCLUDE_DIRECTORIES( 15 | "${CMAKE_SOURCE_DIR}/src" 16 | "${CMAKE_SOURCE_DIR}/src/sparse" 17 | "${CMAKE_SOURCE_DIR}/py") 18 | 19 | SET(CMAKE_SWIG_FLAGS "-Wall") 20 | 21 | SET(CMAKE_SWIG_OUTDIR ${CMAKE_BINARY_DIR}/py) 22 | 23 | SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/py) 24 | 25 | SET_SOURCE_FILES_PROPERTIES(${ONED_SRC_I} PROPERTIES CPLUSPLUS ON) 26 | 27 | SWIG_ADD_MODULE(oneDSolver python ${ONED_SRC_I}) 28 | 29 | ADD_LIBRARY(onedsolver STATIC ${SRC_C}) 30 | 31 | SWIG_LINK_LIBRARIES(oneDSolver onedsolver ${PYTHON_LIBRARIES}) 32 | 33 | # COPY ALL PYTHON FILES TO THE PY FOLDER 34 | file(GLOB pyFiles "${CMAKE_SOURCE_DIR}/py/*.*") 35 | file(COPY ${pyFiles} DESTINATION ${CMAKE_BINARY_DIR}/py/) 36 | 37 | ENDIF() 38 | -------------------------------------------------------------------------------- /py/oneDSolver.tmp: -------------------------------------------------------------------------------- 1 | %module oneDSolver 2 | %{ 3 | /* Includes the header in the wrapper code */ 4 | #include "cvException.h" 5 | #include "cvOneDBFSolver.h" 6 | #include "cvOneDComplex.h" 7 | #include "cvOneDDataTable.h" 8 | #include "cvOneDDenseMatrix.h" 9 | #include "cvOneDEnums.h" 10 | #include "cvOneDError.h" 11 | #include "cvOneDFEAJoint.h" 12 | #include "cvOneDFEAVector.h" 13 | #include "cvOneDFiniteElement.h" 14 | #include "cvOneDGlobal.h" 15 | #include "cvOneDJoint.h" 16 | #include "cvOneDLinearSolver.h" 17 | #include "cvOneDMaterial.h" 18 | #include "cvOneDMaterialLinear.h" 19 | #include "cvOneDMaterialManager.h" 20 | #include "cvOneDMaterialOlufsen.h" 21 | #include "cvOneDMatrix.h" 22 | #include "cvOneDMesh.h" 23 | #include "cvOneDMetteImpedance.h" 24 | #include "cvOneDModel.h" 25 | #include "cvOneDModelManager.h" 26 | #include "cvOneDMorphImpedance.h" 27 | #include "cvOneDMthBranchModel.h" 28 | #include "cvOneDMthModelBase.h" 29 | #include "cvOneDMthSegmentModel.h" 30 | #include "cvOneDNode.h" 31 | #include "cvOneDSegment.h" 32 | #include "cvOneDSkylineMatrix.h" 33 | #include "cvOneDSolverDefinitions.h" 34 | #include "cvOneDSparseLinearSolver.h" 35 | #include "cvOneDString.h" 36 | #include "cvOneDSubdomain.h" 37 | #include "cvOneDUtility.h" 38 | #include "cvOneDVector.h" 39 | #include "cvOptions.h" 40 | #include "cvTypes.h" 41 | #include "cvOneDSparseMatrix.h" 42 | #include "main.h" 43 | using namespace std; 44 | %} 45 | 46 | /* Parse the header file to generate wrappers */ 47 | 48 | %include "std_string.i" 49 | %include "std_vector.i" 50 | %include "std_map.i" 51 | %include "cvException.h" 52 | %include "cvOneDBFSolver.h" 53 | %include "cvOneDComplex.h" 54 | %include "cvOneDDataTable.h" 55 | %include "cvOneDDenseMatrix.h" 56 | %include "cvOneDEnums.h" 57 | %include "cvOneDError.h" 58 | %include "cvOneDFEAJoint.h" 59 | %include "cvOneDFEAVector.h" 60 | %include "cvOneDFiniteElement.h" 61 | %include "cvOneDGlobal.h" 62 | %include "cvOneDJoint.h" 63 | %include "cvOneDLinearSolver.h" 64 | %include "cvOneDMaterial.h" 65 | %include "cvOneDMaterialLinear.h" 66 | %include "cvOneDMaterialManager.h" 67 | %include "cvOneDMaterialOlufsen.h" 68 | %include "cvOneDMatrix.h" 69 | %include "cvOneDMesh.h" 70 | %include "cvOneDMetteImpedance.h" 71 | %include "cvOneDModel.h" 72 | %include "cvOneDModelManager.h" 73 | %include "cvOneDMorphImpedance.h" 74 | %include "cvOneDMthBranchModel.h" 75 | %include "cvOneDMthModelBase.h" 76 | %include "cvOneDMthSegmentModel.h" 77 | %include "cvOneDNode.h" 78 | %include "cvOneDSegment.h" 79 | %include "cvOneDSkylineMatrix.h" 80 | %include "cvOneDSolverDefinitions.h" 81 | %include "cvOneDSparseLinearSolver.h" 82 | %include "cvOneDString.h" 83 | %include "cvOneDSubdomain.h" 84 | %include "cvOneDUtility.h" 85 | %include "cvOneDVector.h" 86 | %include "cvTypes.h" 87 | %include "cvOneDSparseMatrix.h" 88 | %include "cvOptions.h" 89 | %include "main.h" 90 | 91 | namespace std { 92 | typedef std::string String; 93 | } 94 | 95 | -------------------------------------------------------------------------------- /py/scripts/fileTemplate.py: -------------------------------------------------------------------------------- 1 | # imports 2 | import sys 3 | import re 4 | import numpy as np 5 | 6 | # ===================================== 7 | # CLASS TO PROCESS TEMPLATE INPUT FILES 8 | # ===================================== 9 | class runFileTemplate(): 10 | 11 | # Constructor 12 | def __init__(self,templateFileName): 13 | # Read Stream In 14 | self.stream = open(templateFileName,'r').read() 15 | parNumbers = re.findall(r'', self.stream) 16 | parInt = [int(value) for value in parNumbers] 17 | self.dims = len(np.unique(parInt)) 18 | 19 | # Generate Realization File 20 | def generate(self,x,outFile): 21 | # Check if the dimensions are compatible 22 | if(self.dims != len(x)): 23 | print 'Dimensions in Template: ' + str(self.dims) 24 | print 'Dimensions in Vector: ' + str(len(x)) 25 | print 'Template file dimensions not compatible. Terminating.' 26 | sys.exit(-1) 27 | # Replace Variables 28 | localStream = self.stream 29 | for loopA in xrange(len(x)): 30 | localStream = localStream.replace('', '%8.4e' % (x[loopA])) 31 | # Save to realization file 32 | text_file = open(outFile,"a+") 33 | text_file.write(localStream) -------------------------------------------------------------------------------- /py/scripts/testRunSolver.py: -------------------------------------------------------------------------------- 1 | # Imports 2 | import numpy as np 3 | from mpi4py import MPI 4 | from runParallelSolver import * 5 | from simResultRecord import * 6 | 7 | # Enums 8 | ip1D = 0 9 | ip2D = 1 10 | dimType = ip2D 11 | 12 | # Set result record 13 | comm = MPI.COMM_WORLD 14 | rank = comm.rank 15 | size = comm.size 16 | 17 | # Get input quantities for solver: NEED TO FILL WITH YOUR SPECIFIC SETTINGS!!! 18 | # Folder with the oneDSolver Executable 19 | exePath = 'insert/exe/folder' 20 | # Folder where the results are to be written 21 | runDIR = 'insert/test run/folder' 22 | # Location of the input file 23 | inputTemplate = 'insert/template/file' 24 | # Location of the output files containing the result summary 25 | outputFile = 'insert/result/summary/file' 26 | # Template File for result file e.g., simpleArtery_Flow_ARTERY_ for "simpleArtery" segment 27 | resNameTempl = 'insert/result file/template name' 28 | 29 | # Generate input variable realizations 30 | # Generate in first processor and then distribute 31 | if(rank == 0): 32 | np.random.seed(seed=0) 33 | totRuns = 15 34 | if(dimType == ip1D): 35 | x = np.zeros((15,1)) 36 | x[:,0] = np.random.normal(loc=2.0, scale=0.2**2, size=totRuns) 37 | elif(dimType == ip2D): 38 | x = np.zeros((15,2)) 39 | x[:,0] = np.random.normal(loc=2.0, scale=0.2**2, size=totRuns) 40 | x[:,1] = np.random.normal(loc=200.0, scale=5.0**2, size=totRuns) 41 | else: 42 | print 'ERROR: Invalid dimtype.' 43 | print 'Terminating.' 44 | MPI.Finalize() 45 | sys.exit(0) 46 | else: 47 | x = None 48 | 49 | # Distribute x to all processors 50 | x = comm.bcast(x,root=0) 51 | 52 | # Set record for result interrogation 53 | allRes = [] 54 | isRow = 0 55 | rowColNum = 5 56 | res = singleTXTFileExtractor(resNameTempl,ipFlow,isRow,rowColNum) 57 | allRes.append(res) 58 | 59 | # Create SolverWrap Object 60 | slv = oneDSolverWrap(exePath,runDIR,inputTemplate,comm,allRes) 61 | 62 | # Run Solver 63 | output = slv.run(x) 64 | 65 | if(rank == 0): 66 | # Print Output 67 | np.savetxt(outputFile,output) 68 | # Complete 69 | print 'Solution Completed!' 70 | --------------------------------------------------------------------------------