Skip to content

Commit

Permalink
adding get_integration_test stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
mtao committed Nov 25, 2024
1 parent 0644b92 commit 8a3d88e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 2 deletions.
3 changes: 2 additions & 1 deletion applications/isotropic_remeshing/examples/raw/camel.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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,
Expand Down
14 changes: 13 additions & 1 deletion applications/isotropic_remeshing/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
#include <filesystem>
#include <nlohmann/json.hpp>
#include <wmtk/applications/utils/element_count_report.hpp>
#include <wmtk/applications/utils/get_integration_test_data_root.hpp>
#include <wmtk/applications/utils/parse_jse.hpp>
#include <wmtk/components/input/InputOptions.hpp>
#include <wmtk/components/multimesh/MeshCollection.hpp>
#include <wmtk/components/multimesh/utils/get_attribute.hpp>
#include <wmtk/components/multimesh/utils/AttributeDescription.hpp>
#include <wmtk/components/multimesh/utils/get_attribute.hpp>
#include "wmtk/components/utils/PathResolver.hpp"

#include <wmtk/Mesh.hpp>
Expand All @@ -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(
Expand All @@ -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<wmtk::components::input::InputOptions>();
Expand Down
3 changes: 3 additions & 0 deletions applications/utils/src/wmtk/applications/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

)
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <filesystem>
#include <fstream>
#include <nlohmann/json.hpp>

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"];


}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once
#include <filesystem>

namespace wmtk::applications::utils {
std::filesystem::path get_integration_test_data_root(const std::filesystem::path& js_path, const std::filesystem::path& app_path) ;
}

0 comments on commit 8a3d88e

Please sign in to comment.