Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hackathon/edge mesh #378

Merged
merged 59 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
ba90699
add dummy files
Zhouyuan-Chen Sep 22, 2023
5095f98
fixed problem
Zhouyuan-Chen Sep 22, 2023
f792fb4
added throws for safety
Zhouyuan-Chen Sep 22, 2023
d412649
implemented some EdgeMesh functions
Zhouyuan-Chen Sep 22, 2023
96325c6
add EdgeMeshOperationExecutor and DEBUG_EdgeMesh
Zhouyuan-Chen Sep 26, 2023
b749fac
add EdgeMesh_example and test code
Zhouyuan-Chen Sep 27, 2023
01ba6f1
fix a bug for EdgeMesh::initialize, the loop's condition wrong.
Zhouyuan-Chen Sep 27, 2023
d9e3742
Merge remote-tracking branch 'origin/main' into hackathon/edge_mesh
zlyfunction Sep 27, 2023
37392a7
get the desired frame for edgemesh operation executor
zlyfunction Sep 27, 2023
b551d2d
implement edgemesh split_edge
zlyfunction Sep 27, 2023
913e166
fimish edgemesh split_edge with return tuple
zlyfunction Sep 27, 2023
455c867
correct edgemsh split without aorientation assumptions
zlyfunction Sep 27, 2023
a75edd4
implement edge mesh connectivity
JcDai Sep 27, 2023
b6e2844
take care of the case of self loop
zlyfunction Sep 27, 2023
588530a
a complete draft of edge mesh operations
zlyfunction Sep 27, 2023
2f50e69
Merge branch 'hackathon/edge_mesh' of https://github.com/wildmeshing/…
JcDai Sep 27, 2023
b006e30
implemented edge mesh
JcDai Sep 27, 2023
1a91445
add 1d topology unit test
JcDai Sep 27, 2023
7f9f178
add implementation for operations in edgemesh clas
JcDai Sep 27, 2023
0f1e5c4
fix typo
JcDai Sep 27, 2023
4b549e2
add debug_edgemesh examples
JcDai Sep 27, 2023
d6f79e0
fix bug
JcDai Sep 27, 2023
51e750d
rename tmoe to emoe
zlyfunction Sep 27, 2023
9d210e5
add 1d tuple tests
JcDai Sep 27, 2023
4c1fc6d
Merge branch 'hackathon/edge_mesh' of https://github.com/wildmeshing/…
JcDai Sep 27, 2023
6cd9330
Merge remote-tracking branch 'origin/main' into hackathon/edge_mesh
JcDai Sep 27, 2023
8443678
clean codes
JcDai Sep 27, 2023
93078ed
fix collapse
zlyfunction Sep 28, 2023
0191bc1
add test simplices_to_delete_for_split_1D
zlyfunction Sep 28, 2023
f9339ea
add test simplices_to_delete
zlyfunction Sep 28, 2023
e680734
add split and collapse test, need fix collapse
zlyfunction Sep 28, 2023
36f5b4b
fix ccw, still need fix collapse
zlyfunction Sep 28, 2023
d5ae116
add more 1d topology test
JcDai Sep 28, 2023
8cbc009
Merge branch 'hackathon/edge_mesh' of https://github.com/wildmeshing/…
JcDai Sep 28, 2023
436714d
fix collapse, seems to be correct
zlyfunction Sep 28, 2023
3af5411
Merge branch 'hackathon/edge_mesh' of https://github.com/wildmeshing/…
JcDai Sep 28, 2023
d3fd978
add is_simplex_deleted function in DEBUG_EdgeMesh
zlyfunction Sep 28, 2023
8163b71
fix collapse edge ev update
zlyfunction Sep 28, 2023
36ef0f2
fix bug for self loop otopo init
JcDai Sep 28, 2023
4fff8d8
Merge branch 'main' into hackathon/edge_mesh
Sep 29, 2023
e43b219
collapse test add return_tuple check and delete simplex test
Sep 29, 2023
4f59656
fix bug in update ve in collapse edge
Sep 29, 2023
e20fd21
finish testing collapse edge
Sep 29, 2023
add571d
fix bug in split_edge ev update
Sep 29, 2023
22c615a
finish split test
zlyfunction Sep 29, 2023
3844c20
refactor based on comments
JcDai Oct 3, 2023
57f8aae
Merge remote-tracking branch 'origin/main' into hackathon/edge_mesh
JcDai Oct 3, 2023
cf18878
add throw
JcDai Oct 3, 2023
56e6040
redo changes in TriMesh
JcDai Oct 3, 2023
d3cd444
rollback the redo for Trimesh
JcDai Oct 3, 2023
29a6674
refactor based on comments
zlyfunction Oct 4, 2023
fd11974
reuse hash acc in tests
zlyfunction Oct 4, 2023
88f62a7
fix DEBUG_EdgeMesh::operator==
zlyfunction Oct 4, 2023
0409e9b
Merge branch 'main' into hackathon/edge_mesh
zlyfunction Oct 9, 2023
281e5cc
Merge branch 'main' of https://github.com/wildmeshing/wildmeshing-too…
zlyfunction Oct 9, 2023
6540991
modify to fit the changes happend in main branch
zlyfunction Oct 9, 2023
3ee54bc
typo in comment
zlyfunction Oct 11, 2023
25251ca
fix compile
zlyfunction Oct 11, 2023
e991d24
delete TODO in comments
zlyfunction Oct 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/wmtk/EdgeMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ Tuple EdgeMesh::switch_tuple(const Tuple& tuple, PrimitiveType type) const

// TODO: This is for special case self-loop, just to make sure the local vid of the returned
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this TODO still a TODO?

// tuple is the same as the input. (When doing double-switch this is needed)
if (gcid_new == tuple.m_global_cid) return tuple;

if (gcid_new == tuple.m_global_cid) {
return tuple;
}

long lvid_new = -1;

Expand Down
4 changes: 4 additions & 0 deletions src/wmtk/EdgeMeshOperationExecutor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class EdgeMesh::EdgeMeshOperationExecutor
* @brief gather all simplices that are deleted in a split
*
* The deleted simplex is the edge itself
zlyfunction marked this conversation as resolved.
Show resolved Hide resolved
* @return std::array<std::vector<long>, 2> first vector contains the vertex ids, second vector
* contains the edge ids
*/
static const std::array<std::vector<long>, 2> get_split_simplices_to_delete(
JcDai marked this conversation as resolved.
Show resolved Hide resolved
const Tuple& tuple,
Expand All @@ -30,6 +32,8 @@ class EdgeMesh::EdgeMeshOperationExecutor
* @brief gather all simplices that are deleted in a collapse
*
* The deleted simplices are the vertex and the edge of the input tuple
* @return std::array<std::vector<long>, 2> first vector contains the vertex ids, second vector
* contains the edge ids
*/
static const std::array<std::vector<long>, 2> get_collapse_simplices_to_delete(
JcDai marked this conversation as resolved.
Show resolved Hide resolved
const Tuple& tuple,
Expand Down
41 changes: 15 additions & 26 deletions tests/test_tuple_1d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,24 +109,19 @@ TEST_CASE("1D_multiple_lines", "[tuple_generation], [tuple_1d]")
{
const std::vector<Tuple> vertices = m.get_all(PrimitiveType::Vertex);
REQUIRE(vertices.size() == 6);
CHECK(m.id(vertices[0], PrimitiveType::Vertex) == 0);
CHECK(m.id(vertices[1], PrimitiveType::Vertex) == 1);
CHECK(m.id(vertices[2], PrimitiveType::Vertex) == 2);
CHECK(m.id(vertices[3], PrimitiveType::Vertex) == 3);
CHECK(m.id(vertices[4], PrimitiveType::Vertex) == 4);
CHECK(m.id(vertices[5], PrimitiveType::Vertex) == 5);
for (long i = 0; i < 6; ++i) {
CHECK(m.id(vertices[i], PrimitiveType::Vertex) == i);
}
CHECK(m.id(vertices[0], PrimitiveType::Edge) == 0);
CHECK(m.id(vertices[5], PrimitiveType::Edge) == 4);
}
SECTION("edges")
{
const std::vector<Tuple> edges = m.get_all(PrimitiveType::Edge);
REQUIRE(edges.size() == 5);
JcDai marked this conversation as resolved.
Show resolved Hide resolved
CHECK(m.id(edges[0], PrimitiveType::Edge) == 0);
CHECK(m.id(edges[1], PrimitiveType::Edge) == 1);
CHECK(m.id(edges[2], PrimitiveType::Edge) == 2);
CHECK(m.id(edges[3], PrimitiveType::Edge) == 3);
CHECK(m.id(edges[4], PrimitiveType::Edge) == 4);
for (long i = 0; i < 5; ++i) {
CHECK(m.id(edges[i], PrimitiveType::Edge) == i);
}
}
}

Expand All @@ -138,23 +133,17 @@ TEST_CASE("1D_loop_lines", "[tuple_generation], [tuple_1d]")
{
const std::vector<Tuple> vertices = m.get_all(PrimitiveType::Vertex);
REQUIRE(vertices.size() == 6);
CHECK(m.id(vertices[0], PrimitiveType::Vertex) == 0);
CHECK(m.id(vertices[1], PrimitiveType::Vertex) == 1);
CHECK(m.id(vertices[2], PrimitiveType::Vertex) == 2);
CHECK(m.id(vertices[3], PrimitiveType::Vertex) == 3);
CHECK(m.id(vertices[4], PrimitiveType::Vertex) == 4);
CHECK(m.id(vertices[5], PrimitiveType::Vertex) == 5);
for (long i = 0; i < 6; ++i) {
CHECK(m.id(vertices[i], PrimitiveType::Vertex) == i);
}
}
SECTION("edges")
{
const std::vector<Tuple> edges = m.get_all(PrimitiveType::Edge);
REQUIRE(edges.size() == 6);
CHECK(m.id(edges[0], PrimitiveType::Edge) == 0);
CHECK(m.id(edges[1], PrimitiveType::Edge) == 1);
CHECK(m.id(edges[2], PrimitiveType::Edge) == 2);
CHECK(m.id(edges[3], PrimitiveType::Edge) == 3);
CHECK(m.id(edges[4], PrimitiveType::Edge) == 4);
CHECK(m.id(edges[5], PrimitiveType::Edge) == 5);
for (long i = 0; i < 6; ++i) {
CHECK(m.id(edges[i], PrimitiveType::Edge) == i);
}
}
}

Expand All @@ -179,7 +168,7 @@ TEST_CASE("1D_self_loop", "[tuple_generation], [tuple_1d]")
TEST_CASE("1D_random_switches", "[tuple_operation],[tuple_1d]")
{
DEBUG_EdgeMesh m = loop_lines();

ConstAccessor<long> hash_accessor = m.get_const_cell_hash_accessor();
SECTION("vertices")
{
const std::vector<Tuple> vertex_tuples = m.get_all(PrimitiveType::Vertex);
Expand All @@ -195,7 +184,7 @@ TEST_CASE("1D_random_switches", "[tuple_operation],[tuple_1d]")
break;
default: break;
}
CHECK(m.is_valid_slow(t));
CHECK(m.is_valid(t, hash_accessor));
}
}
}
Expand All @@ -215,7 +204,7 @@ TEST_CASE("1D_random_switches", "[tuple_operation],[tuple_1d]")
break;
default: break;
}
CHECK(m.is_valid_slow(t));
CHECK(m.is_valid(t, hash_accessor));
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion tests/tools/DEBUG_EdgeMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ DEBUG_EdgeMesh::DEBUG_EdgeMesh(EdgeMesh&& m)

bool DEBUG_EdgeMesh::operator==(const DEBUG_EdgeMesh& o) const
{
return static_cast<const DEBUG_EdgeMesh&>(*this) == static_cast<const DEBUG_EdgeMesh&>(o);
throw("This function is not tested yet");
return static_cast<const EdgeMesh&>(*this) == static_cast<const EdgeMesh&>(o);
}
bool DEBUG_EdgeMesh::operator!=(const DEBUG_EdgeMesh& o) const
{
throw("This function is not tested yet");
return !(*this == o);
}

Expand Down
Loading