Wildmeshing Toolkit
Loading...
Searching...
No Matches
local_switch_tuple.hxx
Go to the documentation of this file.
1#pragma once
2#include <cassert>
3#include <stdexcept>
8
9
12{
13 const int64_t offset = local_id_table_offset(tuple);
14
15
16 const int64_t global_cid = tuple.global_cid();
17 switch (pt) {
19 return Tuple(
20 auto_3d_table_vertex[offset][0],
21 auto_3d_table_vertex[offset][1],
22 auto_3d_table_vertex[offset][2],
23 global_cid);
24
26 return Tuple(
27 auto_3d_table_edge[offset][0],
28 auto_3d_table_edge[offset][1],
29 auto_3d_table_edge[offset][2],
30 global_cid);
32 return Tuple(
33 auto_3d_table_face[offset][0],
34 auto_3d_table_face[offset][1],
35 auto_3d_table_face[offset][2],
36 global_cid);
37
39 default: assert(false); // "Tuple switch: Invalid primitive type"
40 }
41 return Tuple();
42}
43
44inline Tuple local_switch_tuple(const Tuple& t, int8_t valid_tuple_index)
45{
46 int8_t input_index = valid_index_from_tuple(t);
47 const int8_t product_result = auto_valid_switch_product_table[input_index][valid_tuple_index];
48 return tuple_from_valid_index(t.global_cid(), product_result);
49}
50
61} // namespace wmtk::autogen::tet_mesh
The Tuple is the basic navigation tool in our mesh data structure.
Definition Tuple.hpp:19
int64_t global_cid() const
Definition Tuple.hxx:47
int8_t switch_primitive_to_valid_tuple_index(wmtk::PrimitiveType pt)
const int64_t auto_3d_table_face[96][3]
const int8_t auto_valid_switch_product_table[24][24]
Tuple local_switch_tuple(const Tuple &t, PrimitiveType pt)
const int64_t auto_3d_table_vertex[96][3]
const int8_t auto_valid_tuple_switch_indices[5]
int8_t valid_index_from_tuple(const Tuple &t)
const int64_t auto_3d_table_edge[96][3]
int64_t local_id_table_offset(const Tuple &t)
Tuple tuple_from_valid_index(int64_t global_cid, int8_t valid_tuple_index)
constexpr int8_t get_primitive_type_id(PrimitiveType t)
Get a unique integer id corresponding to each primitive type.