-
Notifications
You must be signed in to change notification settings - Fork 20
Testing tuple_from_id #844
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
08b183f
adding test for autogen + moving functions for getting tuples from si…
mtao 25fd711
adding test for autogen + moving functions for getting tuples from si…
mtao c7cfccf
fixing and adding unit tests for tuple_from_id unit etsts
mtao 405b32c
removing concepts-based auto because osx/windows runners complained
mtao 13cb315
removing default value in get_tuple_from_simplex_local_id
mtao b8f0df8
adding range checks in get_tuple_from_simplex_local_id
mtao b1dc298
cleaning up get_tuple_from_simplex_local_id to shove assertions into …
mtao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/wmtk/autogen/edge_mesh/get_tuple_from_simplex_local_id.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #pragma once | ||
| #include <cassert> | ||
| #include <wmtk/Tuple.hpp> | ||
| #include "autogenerated_tables.hpp" | ||
| #if !defined(_NDEBUG) | ||
| #include "is_ccw.hpp" | ||
| #endif | ||
|
|
||
| namespace wmtk::autogen::edge_mesh { | ||
|
|
||
| inline Tuple get_tuple_from_simplex_local_vertex_id(int8_t local_id, int64_t global_id) | ||
| { | ||
| assert(local_id >= 0); | ||
| assert(local_id < 2); | ||
| return Tuple(local_id, -1, -1, global_id); | ||
| } | ||
| inline Tuple | ||
| get_tuple_from_simplex_local_id(PrimitiveType pt, int8_t local_id, int64_t global_fid) | ||
| { | ||
| switch (pt) { | ||
| case PrimitiveType::Vertex: return get_tuple_from_simplex_local_vertex_id(local_id, global_fid); | ||
| case PrimitiveType::Edge: | ||
| case PrimitiveType::Triangle: | ||
| default: | ||
| case PrimitiveType::Tetrahedron: assert(false); return {}; | ||
| } | ||
| } | ||
| } // namespace wmtk::autogen::edge_mesh | ||
48 changes: 48 additions & 0 deletions
48
src/wmtk/autogen/tet_mesh/get_tuple_from_simplex_local_id.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| #pragma once | ||
| #include <cassert> | ||
| #include <wmtk/Tuple.hpp> | ||
| #include "autogenerated_tables.hpp" | ||
| #if !defined(_NDEBUG) | ||
| #include "is_ccw.hpp" | ||
| #endif | ||
|
|
||
| namespace wmtk::autogen::tet_mesh { | ||
|
|
||
| inline Tuple get_tuple_from_simplex_local_vertex_id(int8_t local_id, int64_t global_id) | ||
| { | ||
| assert(local_id >= 0); | ||
| assert(local_id < 4); | ||
| const auto& arr = autogen::tet_mesh::auto_3d_table_complete_vertex[local_id]; | ||
| const auto& [lvid, leid, lfid] = arr; | ||
| Tuple tuple = Tuple(lvid, leid, lfid, global_id); | ||
| return tuple; | ||
| } | ||
| inline Tuple get_tuple_from_simplex_local_edge_id(int8_t local_id, int64_t global_id) | ||
| { | ||
| assert(local_id >= 0); | ||
| assert(local_id < 6); | ||
| const auto& arr = autogen::tet_mesh::auto_3d_table_complete_edge[local_id]; | ||
| const auto& [lvid, leid, lfid] = arr; | ||
| Tuple tuple = Tuple(lvid, leid, lfid, global_id); | ||
| return tuple; | ||
| } | ||
| inline Tuple get_tuple_from_simplex_local_face_id(int8_t local_id, int64_t global_id) | ||
| { | ||
| assert(local_id >= 0); | ||
| assert(local_id < 4); | ||
| const auto& arr = autogen::tet_mesh::auto_3d_table_complete_face[local_id]; | ||
| const auto& [lvid, leid, lfid] = arr; | ||
| Tuple tuple = Tuple(lvid, leid, lfid, global_id); | ||
| return tuple; | ||
| } | ||
| inline Tuple get_tuple_from_simplex_local_id(PrimitiveType pt, int8_t local_id, int64_t global_fid) | ||
| { | ||
| switch (pt) { | ||
| case PrimitiveType::Vertex: return get_tuple_from_simplex_local_vertex_id(local_id, global_fid); | ||
| case PrimitiveType::Edge: return get_tuple_from_simplex_local_edge_id(local_id, global_fid); | ||
| case PrimitiveType::Triangle: return get_tuple_from_simplex_local_face_id(local_id, global_fid); | ||
| default: | ||
| case PrimitiveType::Tetrahedron: assert(false); return {}; | ||
| } | ||
| } | ||
| } // namespace wmtk::autogen::tet_mesh | ||
39 changes: 39 additions & 0 deletions
39
src/wmtk/autogen/tri_mesh/get_tuple_from_simplex_local_id.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #pragma once | ||
| #include <cassert> | ||
| #include <wmtk/Tuple.hpp> | ||
| #include "autogenerated_tables.hpp" | ||
| #if !defined(_NDEBUG) | ||
| #include "is_ccw.hpp" | ||
| #endif | ||
|
|
||
| namespace wmtk::autogen::tri_mesh { | ||
| inline Tuple get_tuple_from_simplex_local_vertex_id(int8_t local_id, int64_t global_id) | ||
| { | ||
| assert(local_id >= 0); | ||
| assert(local_id < 3); | ||
|
|
||
| const auto& arr = autogen::tri_mesh::auto_2d_table_complete_vertex[local_id]; | ||
| const auto& [lvid, leid] = arr; | ||
| Tuple tuple = Tuple(lvid, leid, -1, global_id); | ||
| return tuple; | ||
| } | ||
| inline Tuple get_tuple_from_simplex_local_edge_id(int8_t local_id, int64_t global_id) | ||
| { | ||
| assert(local_id >= 0); | ||
| assert(local_id < 3); | ||
| const auto& arr = autogen::tri_mesh::auto_2d_table_complete_edge[local_id]; | ||
| const auto& [lvid, leid] = arr; | ||
| Tuple tuple = Tuple(lvid, leid, -1, global_id); | ||
| return tuple; | ||
| } | ||
| inline Tuple get_tuple_from_simplex_local_id(PrimitiveType pt, int8_t local_id, int64_t global_fid) | ||
| { | ||
| switch (pt) { | ||
| case PrimitiveType::Vertex: return get_tuple_from_simplex_local_vertex_id(local_id, global_fid); | ||
| case PrimitiveType::Edge: return get_tuple_from_simplex_local_edge_id(local_id, global_fid); | ||
| default: | ||
| case PrimitiveType::Triangle: | ||
| case PrimitiveType::Tetrahedron: assert(false); return {}; | ||
| } | ||
| } | ||
| } // namespace wmtk::autogen::tri_mesh | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,5 +2,6 @@ | |
| set(TEST_SOURCES | ||
| dart.cpp | ||
| actions.cpp | ||
| tables.cpp | ||
| ) | ||
| target_sources(wmtk_tests PRIVATE ${TEST_SOURCES}) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An assert for
local_idwould be nice. You have it for the edge mesh.