From 8a3d88e286fe165498fd949f1db4c0295caef245 Mon Sep 17 00:00:00 2001 From: Michael Tao Date: Mon, 25 Nov 2024 13:56:15 -0500 Subject: [PATCH] adding get_integration_test stuff --- .../isotropic_remeshing/examples/raw/camel.json | 3 ++- applications/isotropic_remeshing/main.cpp | 14 +++++++++++++- .../src/wmtk/applications/utils/CMakeLists.txt | 3 +++ .../utils/get_integration_test_data_root.cpp | 14 ++++++++++++++ .../utils/get_integration_test_data_root.hpp | 6 ++++++ 5 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 applications/utils/src/wmtk/applications/utils/get_integration_test_data_root.cpp create mode 100644 applications/utils/src/wmtk/applications/utils/get_integration_test_data_root.hpp diff --git a/applications/isotropic_remeshing/examples/raw/camel.json b/applications/isotropic_remeshing/examples/raw/camel.json index 2000341658..9f90edb653 100644 --- a/applications/isotropic_remeshing/examples/raw/camel.json +++ b/applications/isotropic_remeshing/examples/raw/camel.json @@ -1,6 +1,6 @@ { "input": { - "file": "unit_test/meshes/camel.msh" + "file": "unit_test/meshes/camel.msh", "name_spec": {"pos": "uv"} }, "root": "/home/mtao/git/wildmeshing-toolkit/data/aa0abd4658bb064515ee7cc2a7be87aa", @@ -9,6 +9,7 @@ "length_rel": 1, "length_abs": -1, "lock_boundary": true, + "edge_swap_mode": "valence", "use_for_periodic": false, "dont_disable_split": false, "fix_uv_seam": false, diff --git a/applications/isotropic_remeshing/main.cpp b/applications/isotropic_remeshing/main.cpp index 92a8206d8c..6e7925a472 100644 --- a/applications/isotropic_remeshing/main.cpp +++ b/applications/isotropic_remeshing/main.cpp @@ -4,11 +4,12 @@ #include #include #include +#include #include #include #include -#include #include +#include #include "wmtk/components/utils/PathResolver.hpp" #include @@ -35,9 +36,15 @@ int main(int argc, char* argv[]) app.ignore_case(); fs::path json_input_file; + fs::path json_integration_config_file; app.add_option("-j, --json", json_input_file, "json specification file") ->required(true) ->check(CLI::ExistingFile); + app.add_option( + "-i, --integration-test-config", + json_integration_config_file, + "Test config file for integration test") + ->check(CLI::ExistingFile); CLI11_PARSE(app, argc, argv); // nlohmann::json j = wmtk::applications::utils::parse_jse( @@ -54,6 +61,11 @@ int main(int argc, char* argv[]) if (j.contains("root")) { path_resolver = j["root"]; } + if (!json_integration_config_file.empty()) { + auto path = wmtk::applications::utils::get_integration_test_data_root( + json_integration_config_file, + argv[0]); + } auto input_opts = input_js.get(); diff --git a/applications/utils/src/wmtk/applications/utils/CMakeLists.txt b/applications/utils/src/wmtk/applications/utils/CMakeLists.txt index 1a3d4887e2..cddae8d691 100644 --- a/applications/utils/src/wmtk/applications/utils/CMakeLists.txt +++ b/applications/utils/src/wmtk/applications/utils/CMakeLists.txt @@ -5,4 +5,7 @@ target_sources(wmtk_application_utils PRIVATE parse_jse.hpp parse_jse.cpp + get_integration_test_data_root.hpp + get_integration_test_data_root.cpp + ) diff --git a/applications/utils/src/wmtk/applications/utils/get_integration_test_data_root.cpp b/applications/utils/src/wmtk/applications/utils/get_integration_test_data_root.cpp new file mode 100644 index 0000000000..5e40edd77e --- /dev/null +++ b/applications/utils/src/wmtk/applications/utils/get_integration_test_data_root.cpp @@ -0,0 +1,14 @@ +#include +#include +#include + +namespace wmtk::applications::utils { + std::filesystem::path get_integration_test_data_root(const std::filesystem::path& js_path, const std::filesystem::path& app_path) { + std::ifstream ifs(js_path); + nlohmann::json js; + ifs >> js; + return js[app_path.filename()]["data_folder"]; + + + } +} diff --git a/applications/utils/src/wmtk/applications/utils/get_integration_test_data_root.hpp b/applications/utils/src/wmtk/applications/utils/get_integration_test_data_root.hpp new file mode 100644 index 0000000000..5165576e1d --- /dev/null +++ b/applications/utils/src/wmtk/applications/utils/get_integration_test_data_root.hpp @@ -0,0 +1,6 @@ +#pragma once +#include + +namespace wmtk::applications::utils { + std::filesystem::path get_integration_test_data_root(const std::filesystem::path& js_path, const std::filesystem::path& app_path) ; +}