12bool hash_free_tuple_equality(
const Tuple& a,
const Tuple& b)
14 return a.local_vid() == b.local_vid() && a.local_eid() == b.local_eid() &&
15 a.local_fid() == b.local_fid() && a.global_cid() == b.global_cid();
18std::optional<std::vector<PrimitiveType>> find_local_switch_sequence_on_edge(
24 if (hash_free_tuple_equality(source, target)) {
25 return std::vector<PrimitiveType>{};
26 }
else if (hash_free_tuple_equality(
34std::optional<std::vector<PrimitiveType>> find_local_switch_sequence_on_triangle(
41 Tuple cur_tuple = source;
42 std::vector<PrimitiveType> switches;
44 const auto edge_local_operations =
45 find_local_switch_sequence_on_edge(mesh_pt, cur_tuple, target);
46 if (edge_local_operations.has_value()) {
47 return edge_local_operations.value();
53 const auto edge_local_operations =
54 find_local_switch_sequence_on_edge(mesh_pt, cur_tuple, target);
55 if (edge_local_operations.has_value()) {
58 edge_local_operations.value().begin(),
59 edge_local_operations.value().end());
67 const auto edge_local_operations =
68 find_local_switch_sequence_on_edge(mesh_pt, cur_tuple, target);
69 if (edge_local_operations.has_value()) {
72 edge_local_operations.value().begin(),
73 edge_local_operations.value().end());
80std::optional<std::vector<PrimitiveType>> find_local_switch_sequence_on_tet(
86 Tuple cur_tuple = source;
87 std::vector<PrimitiveType> switches;
90 const auto triangle_local_operations =
91 find_local_switch_sequence_on_triangle(mesh_pt, cur_tuple, target);
92 if (triangle_local_operations.has_value()) {
93 return triangle_local_operations.value();
99 const auto triangle_local_operations =
100 find_local_switch_sequence_on_triangle(mesh_pt, cur_tuple, target);
101 if (triangle_local_operations.has_value()) {
104 triangle_local_operations.value().begin(),
105 triangle_local_operations.value().end());
113 const auto triangle_local_operations =
114 find_local_switch_sequence_on_triangle(mesh_pt, cur_tuple, target);
115 if (triangle_local_operations.has_value()) {
118 triangle_local_operations.value().begin(),
119 triangle_local_operations.value().end());
127 const auto triangle_local_operations =
128 find_local_switch_sequence_on_triangle(mesh_pt, cur_tuple, target);
129 if (triangle_local_operations.has_value()) {
132 triangle_local_operations.value().begin(),
133 triangle_local_operations.value().end());
145std::vector<PrimitiveType>
148 switch (primitive_type) {
150 const auto operations =
152 if (!operations.has_value()) {
153 throw std::runtime_error(
154 "switch sequence was unable to find a sequence of switches to match tuples");
156 return operations.value();
159 const auto operations =
161 if (!operations.has_value()) {
162 throw std::runtime_error(
163 "switch sequence was unable to find a sequence of switches to match tuples");
165 return operations.value();
168 const auto operations =
170 if (!operations.has_value()) {
171 throw std::runtime_error(
172 "switch sequence was unable to find a sequence of switches to match tuples");
174 return operations.value();
The Tuple is the basic navigation tool in our mesh data structure.
std::vector< PrimitiveType > find_local_switch_sequence(const Tuple &source, const Tuple &target, PrimitiveType primitive_type)
Tuple local_switch_tuples(PrimitiveType mesh_primitive_type, const Tuple &tuple, const std::initializer_list< PrimitiveType > &op_sequence)
Tuple local_switch_tuple(PrimitiveType mesh_primitive_type, const Tuple &source, PrimitiveType primitive_type)