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::tri_mesh {
10 inline Tuple get_tuple_from_simplex_local_vertex_id(int8_t local_id, int64_t global_id)
11 {
12  assert(local_id >= 0);
13  assert(local_id < 3);
14 
15  const auto& arr = autogen::tri_mesh::auto_2d_table_complete_vertex[local_id];
16  const auto& [lvid, leid] = arr;
17  Tuple tuple = Tuple(lvid, leid, -1, 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 < 3);
24  const auto& arr = autogen::tri_mesh::auto_2d_table_complete_edge[local_id];
25  const auto& [lvid, leid] = arr;
26  Tuple tuple = Tuple(lvid, leid, -1, global_id);
27  return tuple;
28 }
29 inline Tuple get_tuple_from_simplex_local_id(PrimitiveType pt, int8_t local_id, int64_t global_fid)
30 {
31  switch (pt) {
32  case PrimitiveType::Vertex: return get_tuple_from_simplex_local_vertex_id(local_id, global_fid);
33  case PrimitiveType::Edge: return get_tuple_from_simplex_local_edge_id(local_id, global_fid);
34  default:
36  case PrimitiveType::Tetrahedron: assert(false); return {};
37  }
38 }
39 } // namespace wmtk::autogen::tri_mesh
const int64_t auto_2d_table_complete_vertex[3][2]
const int64_t auto_2d_table_complete_edge[3][2]
Tuple get_tuple_from_simplex_local_vertex_id(int8_t local_id, int64_t global_id)
Tuple get_tuple_from_simplex_local_edge_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)