1 #include <catch2/catch_test_macros.hpp>
3 #include <nlohmann/json.hpp>
4 #include <tools/DEBUG_TetMesh.hpp>
5 #include <tools/DEBUG_TriMesh.hpp>
6 #include <tools/TetMesh_examples.hpp>
7 #include <tools/TriMesh_examples.hpp>
18 const std::filesystem::path
data_dir = WMTK_DATA_DIR;
20 TEST_CASE(
"regular_space_file_reading",
"[components][regular_space]")
22 using namespace components::internal;
24 std::map<std::string, std::filesystem::path> files;
25 std::map<std::string, int64_t> tags_value;
28 {
"input",
"input_mesh"},
29 {
"output",
"output_mesh"},
30 {
"attributes", {{
"edge_label",
"edge_tag_name"}}},
31 {
"values", json::array({2})},
32 {
"pass_through", json::array({})}};
34 CHECK_NOTHROW(o.get<RegularSpaceOptions>());
37 TEST_CASE(
"regular_space_component_tri",
"[components][regular_space][trimesh][2D][scheduler]")
39 const int64_t tag_value = 1;
40 tests::DEBUG_TriMesh m = wmtk::tests::hex_plus_two_with_position();
48 std::vector<wmtk::attribute::MeshAttributeHandle> label_attributes;
49 label_attributes.emplace_back(face_tag_handle);
50 label_attributes.emplace_back(edge_tag_handle);
51 label_attributes.emplace_back(vertex_tag_handle);
53 std::vector<int64_t> label_values = {tag_value, tag_value, tag_value};
55 std::vector<attribute::MeshAttributeHandle> pass_through_attributes;
56 pass_through_attributes.emplace_back(
59 SECTION(
"points_in_2d_case")
81 pass_through_attributes);
88 data_dir /
"regular_space_result_0d_case",
98 SECTION(
"edges_in_2d_case")
118 acc_edge_tag.
scalar_attribute(m.edge_tuple_with_vs_and_t(4, 5, 2)) = tag_value;
119 acc_edge_tag.
scalar_attribute(m.edge_tuple_with_vs_and_t(5, 1, 2)) = tag_value;
120 acc_edge_tag.
scalar_attribute(m.edge_tuple_with_vs_and_t(1, 4, 2)) = tag_value;
121 acc_edge_tag.
scalar_attribute(m.edge_tuple_with_vs_and_t(7, 4, 5)) = tag_value;
122 acc_edge_tag.
scalar_attribute(m.edge_tuple_with_vs_and_t(7, 3, 5)) = tag_value;
129 pass_through_attributes);
137 data_dir /
"regular_space_result_1d_case",
149 TEST_CASE(
"regular_space_component_tet",
"[components][regular_space][tetmesh][3D][scheduler][.]")
151 using namespace tests_3d;
164 DEBUG_TetMesh m = six_cycle_tets();
165 const int64_t tag_value = 1;
166 Eigen::MatrixXd V(8, 3);
167 V.row(0) << 0.5, 0.86, 0;
169 V.row(2) << 1.0, 0, 1.0;
170 V.row(3) << 1.0, 0, -1.0;
171 V.row(4) << 1.5, 0.86, 0;
173 V.row(6) << 0.5, -0.86, 0;
174 V.row(7) << 1.5, -0.86, 0;
180 std::vector<wmtk::attribute::MeshAttributeHandle> label_attributes;
181 label_attributes.emplace_back(edge_tag_handle);
182 label_attributes.emplace_back(vertex_tag_handle);
184 std::vector<int64_t> label_values = {tag_value, tag_value};
186 std::vector<attribute::MeshAttributeHandle> pass_through_attributes;
187 pass_through_attributes.emplace_back(
190 SECTION(
"points_in_3d_case")
203 pass_through_attributes);
210 data_dir /
"regular_space_result_points_3d_case",
220 SECTION(
"edges_in_3d_case")
232 acc_edge_tag.
scalar_attribute(m.edge_tuple_with_vs_and_t(0, 1, 0)) = tag_value;
233 acc_edge_tag.
scalar_attribute(m.edge_tuple_with_vs_and_t(0, 2, 0)) = tag_value;
234 acc_edge_tag.
scalar_attribute(m.edge_tuple_with_vs_and_t(0, 3, 0)) = tag_value;
235 acc_edge_tag.
scalar_attribute(m.edge_tuple_with_vs_and_t(1, 2, 0)) = tag_value;
236 acc_edge_tag.
scalar_attribute(m.edge_tuple_with_vs_and_t(2, 3, 0)) = tag_value;
237 acc_edge_tag.
scalar_attribute(m.edge_tuple_with_vs_and_t(3, 1, 0)) = tag_value;
238 acc_edge_tag.
scalar_attribute(m.edge_tuple_with_vs_and_t(2, 5, 2)) = tag_value;
244 pass_through_attributes);
251 data_dir /
"regular_space_result_edges_3d_case",
T & scalar_attribute(const ArgType &t)
const std::filesystem::path data_dir
TEST_CASE("regular_space_file_reading", "[components][regular_space]")