Wildmeshing Toolkit
Loading...
Searching...
No Matches
ear_actions.cpp
Go to the documentation of this file.
1#include "ear_actions.hpp"
4namespace {
5auto make_opp_actions() -> std::array<int8_t, 4>
6{
7 std::array<int8_t, 4> darts;
8 darts[0] = 0;
9 for (int8_t j = 1; j < darts.size(); ++j) {
12 darts[j] = sd.opposite();
13 }
14 //
15 return darts;
16}
17auto make_right_ear_darts() -> std::array<int8_t, 4>
18{
19 return make_opp_actions();
20}
21auto make_left_ear_darts() -> std::array<int8_t, 4>
22{
23 auto darts = make_opp_actions();
24 for (int8_t j = 1; j < darts.size(); ++j) {
27 int8_t& action = darts[j];
28 action = sd.product(action, sd.primitive_as_index(wmtk::PrimitiveType::Vertex));
29 }
30 return darts;
31}
32const static std::array<int8_t, 4> left_ear_darts = make_left_ear_darts();
33const static std::array<int8_t, 4> right_ear_darts = make_right_ear_darts();
34
35} // namespace
37{
38 const size_t off = get_primitive_type_id(mesh_type);
39 return left_ear_darts[off];
40}
42{
43 const size_t off = get_primitive_type_id(mesh_type);
44 return right_ear_darts[off];
45}
46} // namespace wmtk::operations::internal
int8_t right_ear_action(PrimitiveType mesh_type)
int8_t left_ear_action(PrimitiveType mesh_type)
constexpr PrimitiveType get_primitive_type_from_id(int8_t id)
Get the primitive type corresponding to its unique integer id.
constexpr int8_t get_primitive_type_id(PrimitiveType t)
Get a unique integer id corresponding to each primitive type.