Wildmeshing Toolkit
get_tuple_from_simplex_local_id.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <cassert>
3 #include <wmtk/Tuple.hpp>
5 #if !defined(_NDEBUG)
6 #include "is_ccw.hpp"
7 #endif
8 
9 namespace wmtk::autogen::tet_mesh {
10 
11 inline Tuple get_tuple_from_simplex_local_vertex_id(int8_t local_id, int64_t global_id)
12 {
13  assert(local_id >= 0);
14  assert(local_id < 4);
15  const auto& arr = autogen::tet_mesh::auto_3d_table_complete_vertex[local_id];
16  const auto& [lvid, leid, lfid] = arr;
17  Tuple tuple = Tuple(lvid, leid, lfid, global_id);
18  return tuple;
19 }
20 inline Tuple get_tuple_from_simplex_local_edge_id(int8_t local_id, int64_t global_id)
21 {
22  assert(local_id >= 0);
23  assert(local_id < 6);
24  const auto& arr = autogen::tet_mesh::auto_3d_table_complete_edge[local_id];
25  const auto& [lvid, leid, lfid] = arr;
26  Tuple tuple = Tuple(lvid, leid, lfid, global_id);
27  return tuple;
28 }
29 inline Tuple get_tuple_from_simplex_local_face_id(int8_t local_id, int64_t global_id)
30 {
31  assert(local_id >= 0);
32  assert(local_id < 4);
33  const auto& arr = autogen::tet_mesh::auto_3d_table_complete_face[local_id];
34  const auto& [lvid, leid, lfid] = arr;
35  Tuple tuple = Tuple(lvid, leid, lfid, global_id);
36  return tuple;
37 }
38 inline Tuple get_tuple_from_simplex_local_id(PrimitiveType pt, int8_t local_id, int64_t global_fid)
39 {
40  switch (pt) {
41  case PrimitiveType::Vertex: return get_tuple_from_simplex_local_vertex_id(local_id, global_fid);
42  case PrimitiveType::Edge: return get_tuple_from_simplex_local_edge_id(local_id, global_fid);
43  case PrimitiveType::Triangle: return get_tuple_from_simplex_local_face_id(local_id, global_fid);
44  default:
45  case PrimitiveType::Tetrahedron: assert(false); return {};
46  }
47 }
48 } // namespace wmtk::autogen::tet_mesh
Tuple get_tuple_from_simplex_local_edge_id(int8_t local_id, int64_t global_id)
Tuple get_tuple_from_simplex_local_face_id(int8_t local_id, int64_t global_id)
const int64_t auto_3d_table_complete_vertex[4][3]
const int64_t auto_3d_table_complete_face[4][3]
const int64_t auto_3d_table_complete_edge[6][3]
Tuple get_tuple_from_simplex_local_vertex_id(int8_t local_id, int64_t global_id)
Tuple get_tuple_from_simplex_local_id(PrimitiveType pt, int8_t local_id, int64_t global_fid)