Skip to content

Commit

Permalink
Merge pull request #347 from polyfem/pref-test
Browse files Browse the repository at this point in the history
Pref test
  • Loading branch information
teseoch committed Jun 14, 2024
2 parents 8486c66 + 7a19f68 commit 8958cbe
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ jobs:
lcov --remove coverage.info '/usr/*' "${HOME}"'/.cache/*' '*tests/*.cpp' '*/polyfem/problem/*.cpp' '*/polyfem/problem/*.hpp' --output-file coverage.info
- name: Upload Coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
flags: polyfem # optional
files: coverage.info
Expand Down
31 changes: 31 additions & 0 deletions cmake/recipes/polyfem_pref.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# data (https://github.com/polyfem/polyfem-data)
# License: MIT

if(TARGET polyfem::pref)
return()
endif()

include(ExternalProject)

set(POLYFEM_PREF_DIR "${PROJECT_SOURCE_DIR}/pref-data/" CACHE PATH "Where should polyfem download and look for pref data?")


ExternalProject_Add(
polyfem_pref_download
PREFIX ${FETCHCONTENT_BASE_DIR}/polyfem-test-pref
SOURCE_DIR ${POLYFEM_PREF_DIR}
GIT_REPOSITORY https://github.com/polyfem/Decoupling-Simulation-Accuracy-from-Mesh-Quality
GIT_TAG 4129da2b2c453c70f07ab37a0a717b90c801276e
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
LOG_DOWNLOAD ON
)

# Create a dummy target for convenience
add_library(polyfem_pref INTERFACE)
add_library(polyfem::pref ALIAS polyfem_pref)

add_dependencies(polyfem_pref polyfem_pref_download)

target_compile_definitions(polyfem_pref INTERFACE POLYFEM_PREF_DIR=\"${POLYFEM_PREF_DIR}\")
2 changes: 1 addition & 1 deletion src/polyfem/io/OutData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ namespace polyfem::io

scalar_values = args["output"]["paraview"]["options"]["scalar_values"];
tensor_values = args["output"]["paraview"]["options"]["tensor_values"] && !is_problem_scalar;
discretization_order = args["output"]["paraview"]["options"]["discretization_order"] && !is_problem_scalar;
discretization_order = args["output"]["paraview"]["options"]["discretization_order"];
nodes = args["output"]["paraview"]["options"]["nodes"] && !is_problem_scalar;

use_spline = args["space"]["basis_type"] == "Spline";
Expand Down
3 changes: 3 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ target_link_libraries(unit_tests PUBLIC finitediff::finitediff)
include(polyfem_data)
target_link_libraries(unit_tests PUBLIC polyfem::data)

include(polyfem_pref)
target_link_libraries(unit_tests PUBLIC polyfem::pref)

################################################################################
# Compiler options
################################################################################
Expand Down
28 changes: 28 additions & 0 deletions tests/pref_test_list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
bridge/large_angle_strip_0.json
bridge/large_angle_strip_1.json
bridge/large_angle_strip_2.json
bridge/large_angle_strip_3.json
bridge/large_angle_strip_4.json
bridge/large_angle_strip_5.json
bridge/large_angle_strip_6.json
bridge/large_angle_strip_7.json
bridge/large_angle_strip_8.json
bridge/large_angle_strip_8_no.json
#
main/conditioning_44000_bad.json
main/conditioning_44000_good.json
main/frog.json
#
neo-hookean-2d/large_angle_strip_0.json
neo-hookean-2d/large_angle_strip_1.json
neo-hookean-2d/large_angle_strip_3.json
neo-hookean-2d/large_angle_strip_5.json
neo-hookean-2d/large_angle_strip_7.json
neo-hookean-2d/large_angle_strip_7_no.json
#
neo-hookean-3d/large_angle_0.json
neo-hookean-3d/large_angle_1.json
#neo-hookean-3d/large_angle_3.json
#neo-hookean-3d/large_angle_5.json
#neo-hookean-3d/large_angle_7.json
#neo-hookean-3d/large_angle_7_no.json
17 changes: 14 additions & 3 deletions tests/verify_run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,11 @@ std::string tagsrun = "[run]";
#else
std::string tagsrun = "[.][run]";
#endif
TEST_CASE("runners", tagsrun)

void run_data(const std::string &test_file, const std::string &dir)
{
// Disabled on Windows CI, due to the requirement for Pardiso.
std::ifstream file(POLYFEM_TEST_DIR "/system_test_list.txt");
std::ifstream file(POLYFEM_TEST_DIR "/" + test_file + ".txt");
std::vector<std::string> failing_tests;
std::string line;
while (std::getline(file, line))
Expand All @@ -210,7 +211,7 @@ TEST_CASE("runners", tagsrun)
line = line.substr(1);
}
spdlog::info("Processing {}", line);
AuthenticateResult result = authenticate_json(POLYFEM_DATA_DIR "/" + line, compute_validation);
AuthenticateResult result = authenticate_json(dir + "/" + line, compute_validation);
CAPTURE(line);
CHECK(result == SUCCESS);
if (result != SUCCESS)
Expand All @@ -223,3 +224,13 @@ TEST_CASE("runners", tagsrun)
std::cout << t << std::endl;
}
}

TEST_CASE("runners", tagsrun)
{
run_data("system_test_list", POLYFEM_DATA_DIR);
}

TEST_CASE("runners-pref", tagsrun)
{
run_data("pref_test_list", POLYFEM_PREF_DIR);
}

0 comments on commit 8958cbe

Please sign in to comment.