-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #844 from mtao/mtao/autogen_tests
Testing tuple_from_id
- Loading branch information
Showing
9 changed files
with
248 additions
and
40 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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