Skip to content

Commit

Permalink
fixing merge conflict for main.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
zasexton committed Mar 25, 2024
2 parents b0dc3c0 + b28958c commit bd0fa14
Show file tree
Hide file tree
Showing 96 changed files with 5,674 additions and 129 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ jobs:
- name: Install MacOS dependencies
if: startsWith(matrix.os, 'macos')
run: |
brew install cmake vtk openblas lapack mesa open-mpi qt
brew reinstall -v gcc
brew install -v cmake vtk openblas lapack mesa open-mpi qt
brew install lcov
sudo ln -s /usr/local/opt/qt5/mkspecs /usr/local/mkspecs
sudo ln -s /usr/local/opt/qt5/plugins /usr/local/plugins
- name: Build svFSIplus
run: |
mkdir build
cd build
cmake -DENABLE_COVERAGE=ON -DENABLE_ARRAY_INDEX_CHECKING=ON ..
cmake -DENABLE_COVERAGE=ON -DENABLE_ARRAY_INDEX_CHECKING=ON -DENABLE_UNIT_TEST=ON ..
make -j2
- name: Install test dependencies
run: |
Expand All @@ -39,6 +40,10 @@ jobs:
git lfs pull
cd tests
conda run -n svfsiplus pytest -rPv --durations=0
- name: Run unit tests
run: |
cd build/svFSI-build/Source/svFSI
ctest --verbose
- name: Generate code coverage
if: startsWith(matrix.os, 'ubuntu-22.04')
run: |
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,11 @@ __pycache__

# Doxygen output
Documentation/html/

# genBC files
**/genBC/obj/
**/genBC_svFSIplus/obj/
genBC.exe
AllData
GenBC.int
InitialData
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ set(SV_PETSC_DIR "" CACHE STRING "Path to a local install of the PETSc linear al
set(ENABLE_COVERAGE OFF CACHE BOOL "Enable code coverage")
set(ENABLE_ARRAY_INDEX_CHECKING OFF CACHE BOOL "Enable Array index checking")
set(SV_LOCAL_VTK_PATH "" CACHE STRING "Path to a local build of VTK.")
set(ENABLE_UNIT_TEST OFF CACHE BOOL "Enable Unit Test by Google Test")

#-----------------------------------------------------------------------------
# RPATH handling
Expand Down Expand Up @@ -147,6 +148,7 @@ ExternalProject_Add(svFSI
#-DSV_USE_PETSC:BOOL=${SV_USE_PETSC}
-DSV_PETSC_DIR:STRING=${SV_PETSC_DIR}
-DENABLE_COVERAGE:BOOL=${ENABLE_COVERAGE}
-DENABLE_UNIT_TEST:BOOL=${ENABLE_UNIT_TEST}
-DENABLE_ARRAY_INDEX_CHECKING:BOOL=${ENABLE_ARRAY_INDEX_CHECKING}
-DSV_LOCAL_VTK_PATH:STRING=${SV_LOCAL_VTK_PATH}
${SV_APPLE_CMAKE_ARGS}
Expand Down
52 changes: 52 additions & 0 deletions Code/Source/svFSI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,56 @@ if(ENABLE_COVERAGE)
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
endif()

# unit tests and Google Test
if(ENABLE_UNIT_TEST)

# link pthread on ubuntu20
find_package(Threads REQUIRED)

# install Google Test
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)
FetchContent_MakeAvailable(googletest)
enable_testing()
include(GoogleTest)

# add test.cpp for unit test

# remove the main.cpp and add test.cpp
list(APPEND CSRCS "../../../tests/unitTests/test.cpp")
list(REMOVE_ITEM CSRCS "main.cpp")

# include source files (same as what svFSI does except for main.cpp)
add_executable(run_all_unit_tests ${CSRCS})

# libraries
target_link_libraries(run_all_unit_tests
${GLOBAL_LIBRARIES}
${INTELRUNTIME_LIBRARIES}
${ZLIB_LIBRARY}
${BLAS_LIBRARIES}
${LAPACK_LIBRARIES}
${METIS_SVFSI_LIBRARY_NAME}
${PARMETIS_SVFSI_LIBRARY_NAME}
${TETGEN_LIBRARY_NAME}
${TINYXML_LIBRARY_NAME}
${SV_LIB_SVFSILS_NAME}${SV_MPI_NAME_EXT}
${VTK_LIBRARIES}
)

# link Google Test
target_link_libraries(
run_all_unit_tests
gtest
GTest::gtest_main
pthread # link pthread on ubuntu20
)

# gtest_discover_tests(runUnitTest)
add_test(NAME all_unit_tests COMMAND run_all_unit_tests)

endif()

8 changes: 5 additions & 3 deletions Code/Source/svFSI/ComMod.h
Original file line number Diff line number Diff line change
Expand Up @@ -1397,7 +1397,8 @@ class ComMod {
/// @brief Current equation degrees of freedom
int dof = 0;

/// @brief Global total number of nodes
/// @brief Global total number of nodes, across all meshes (total) and all
/// procs (global)
int gtnNo = 0;

/// @brief Number of equations
Expand Down Expand Up @@ -1436,7 +1437,8 @@ class ComMod {
/// @brief Total number of degrees of freedom per node
int tDof = 0;

/// @brief Total number of nodes
/// @brief Total number of nodes (number of nodes on current proc across
/// all meshes)
int tnNo = 0;

/// @brief Restart Time Step
Expand Down Expand Up @@ -1522,7 +1524,7 @@ class ComMod {
/// @brief LHS matrix
Array<double> Val;

/// @brief Position vector
/// @brief Position vector of mesh nodes (in ref config)
Array<double> x;

/// @brief Old variables (velocity)
Expand Down
Loading

0 comments on commit bd0fa14

Please sign in to comment.