Skip to content

Commit

Permalink
adding test for autogen + moving functions for getting tuples from si…
Browse files Browse the repository at this point in the history
…mplex id out of the meshes
  • Loading branch information
mtao committed Dec 5, 2024
1 parent 08b183f commit 25fd711
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions tests/autogen/tables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
#include <wmtk/autogen/tri_mesh/local_id_table_offset.hpp>
#include <wmtk/autogen/tri_mesh/local_switch_tuple.hpp>
#include "../tools/all_valid_local_tuples.hpp"
#include <wmtk/autogen/edge_mesh/get_tuple_from_simplex_local_id.hpp>
#include <wmtk/autogen/tri_mesh/get_tuple_from_simplex_local_id.hpp>
#include <wmtk/autogen/tet_mesh/get_tuple_from_simplex_local_id.hpp>

using namespace wmtk;
using namespace wmtk::autogen;
Expand Down Expand Up @@ -230,32 +233,83 @@ TEST_CASE("tuple_autogen_is_ccw", "[tuple]")
{
for (const auto& ve : tri_mesh::auto_2d_table_complete_vertex) {
wmtk::Tuple t(ve[0], ve[1], -1, 0);
CHECK(tri_mesh::tuple_is_valid_for_ccw(t));
CHECK(tri_mesh::is_ccw(t));
CHECK(tuple_is_valid_for_ccw(PrimitiveType::Triangle, t));
CHECK(is_ccw(PrimitiveType::Triangle, t));
}
for (const auto& ve : tri_mesh::auto_2d_table_complete_edge) {
wmtk::Tuple t(ve[0], ve[1], -1, 0);
CHECK(tri_mesh::tuple_is_valid_for_ccw(t));
CHECK(tri_mesh::is_ccw(t));
CHECK(tuple_is_valid_for_ccw(PrimitiveType::Triangle, t));
CHECK(is_ccw(PrimitiveType::Triangle, t));
}
for (const auto& ve : tet_mesh::auto_3d_table_complete_vertex) {
wmtk::Tuple t(ve[0], ve[1], ve[2], 0);
CHECK(tet_mesh::tuple_is_valid_for_ccw(t));
CHECK(tet_mesh::is_ccw(t));
CHECK(tuple_is_valid_for_ccw(PrimitiveType::Tetrahedron, t));
CHECK(is_ccw(PrimitiveType::Tetrahedron, t));
}
for (const auto& ve : tet_mesh::auto_3d_table_complete_edge) {
wmtk::Tuple t(ve[0], ve[1], ve[2], 0);
CHECK(tet_mesh::tuple_is_valid_for_ccw(t));
CHECK(tet_mesh::is_ccw(t));
CHECK(tuple_is_valid_for_ccw(PrimitiveType::Tetrahedron, t));
CHECK(is_ccw(PrimitiveType::Tetrahedron, t));
}
for (const auto& ve : tet_mesh::auto_3d_table_complete_face) {
wmtk::Tuple t(ve[0], ve[1], ve[2], 0);
CHECK(tet_mesh::tuple_is_valid_for_ccw(t));
CHECK(tet_mesh::is_ccw(t));
CHECK(tuple_is_valid_for_ccw(PrimitiveType::Tetrahedron, t));
CHECK(is_ccw(PrimitiveType::Tetrahedron, t));
}
}
TEST_CASE("tuple_autogen_from_id_is_ccw", "[tuple]")
{
for(int i = 0; i < 2; ++i) {
Tuple t = wmtk::autogen::edge_mesh::get_tuple_from_simplex_local_vertex_id(i);
Tuple t2 = wmtk::autogen::edge_mesh::get_tuple_from_simplex_local_id(PrimitiveType::Vertex, i);
CHECK(t == t2);
CHECK(edge_mesh::tuple_is_valid_for_ccw(t));
CHECK(edge_mesh::is_ccw(t));
}
for(int i = 0; i < 3; ++i) {
Tuple t = wmtk::autogen::tri_mesh::get_tuple_from_simplex_local_vertex_id(i);
Tuple t2 = wmtk::autogen::tri_mesh::get_tuple_from_simplex_local_id(PrimitiveType::Vertex, i);
CHECK(t == t2);
CHECK(tri_mesh::tuple_is_valid_for_ccw(t));
CHECK(tri_mesh::is_ccw(t));
}
for(int i = 0; i < 3; ++i) {
Tuple t = wmtk::autogen::tri_mesh::get_tuple_from_simplex_local_vertex_id(i);
Tuple t2 = wmtk::autogen::tri_mesh::get_tuple_from_simplex_local_id(PrimitiveType::Edge, i);
CHECK(t == t2);
CHECK(tri_mesh::tuple_is_valid_for_ccw(t));
CHECK(tri_mesh::is_ccw(t));
}

for(int i = 0; i < 4; ++i) {
Tuple t = wmtk::autogen::tet_mesh::get_tuple_from_simplex_local_vertex_id(i);
Tuple t2 = wmtk::autogen::tet_mesh::get_tuple_from_simplex_local_id(PrimitiveType::Vertex, i);
CHECK(t == t2);
CHECK(tet_mesh::tuple_is_valid_for_ccw(t));
CHECK(tet_mesh::is_ccw(t));
}
for(int i = 0; i < 6; ++i) {
Tuple t = wmtk::autogen::tet_mesh::get_tuple_from_simplex_local_vertex_id(i);
Tuple t2 = wmtk::autogen::tet_mesh::get_tuple_from_simplex_local_id(PrimitiveType::Edge, i);
CHECK(t == t2);
CHECK(tet_mesh::tuple_is_valid_for_ccw(t));
CHECK(tet_mesh::is_ccw(t));
}
for(int i = 0; i < 4; ++i) {
Tuple t = wmtk::autogen::tet_mesh::get_tuple_from_simplex_local_vertex_id(i);
Tuple t2 = wmtk::autogen::tet_mesh::get_tuple_from_simplex_local_id(PrimitiveType::Triangle, i);
CHECK(t == t2);
CHECK(tet_mesh::tuple_is_valid_for_ccw(t));
CHECK(tet_mesh::is_ccw(t));
}
}

0 comments on commit 25fd711

Please sign in to comment.