Wildmeshing Toolkit
CollapseAlternateFacetOptionData.cpp
Go to the documentation of this file.
2 #include <wmtk/Mesh.hpp>
8 #include "ear_actions.hpp"
10 
12  const Mesh& m,
13  const autogen::SimplexDart& sd,
14  const Tuple& input_tuple)
15  : input(sd.dart_from_tuple(input_tuple))
16  , alts({{left_switches(m, input_tuple), right_switches(m, input_tuple)}})
17  , local_boundary_indices({{
18  wmtk::utils::TupleInspector::local_id(input_tuple, m.top_simplex_type() - 1),
20  m.switch_tuple(input_tuple, PrimitiveType::Vertex),
21  m.top_simplex_type() - 1),
22  }})
23 {}
24 
26  const Mesh& m,
27  const Tuple& input_tuple)
29  m,
30  autogen::SimplexDart::get_singleton(m.top_simplex_type()),
31  input_tuple)
32 {}
33 
35 {
36  const PrimitiveType mesh_type = m.top_simplex_type();
37  return get_neighbor_action(m, t, left_ear_action(mesh_type));
38 }
40 {
41  const PrimitiveType mesh_type = m.top_simplex_type();
42  return get_neighbor_action(m, t, right_ear_action(mesh_type));
43 }
44 
46  const Mesh& m,
47  const Tuple& t,
48  int8_t local_action) const -> Dart
49 {
50  const PrimitiveType mesh_type = m.top_simplex_type();
51  const PrimitiveType boundary_type = mesh_type - 1;
52  Tuple r = wmtk::autogen::local_switch_tuple(mesh_type, t, local_action);
53  Dart d;
54  if (!m.is_boundary(boundary_type, r)) {
55  const auto& sd = autogen::SimplexDart::get_singleton(m.top_simplex_type());
56  int8_t source_orientation = sd.valid_index_from_tuple(t);
57  r = m.switch_tuple(r, m.top_simplex_type());
58  d = sd.dart_from_tuple(r);
59  int8_t& target_orientation = d.local_orientation();
60  int8_t old = target_orientation;
61 
62  // encode the relative orientaiton at the d orientation
63  target_orientation =
64  autogen::find_local_dart_action(sd, source_orientation, target_orientation);
65  }
66 
67  return d;
68 }
69 } // namespace wmtk::operations::internal
int8_t & local_orientation()
Definition: Dart.hpp:18
static const SimplexDart & get_singleton(wmtk::PrimitiveType simplex_type)
Definition: SimplexDart.cpp:83
Dart get_neighbor_action(const Mesh &m, const Tuple &t, int8_t local_action) const
static int8_t local_id(const Tuple &t, const PrimitiveType pt)
int8_t find_local_dart_action(const SimplexDart &sd, int8_t source, int8_t target)
Tuple local_switch_tuple(PrimitiveType mesh_type, const Tuple &t, PrimitiveType pt)
std::shared_ptr< Mesh > input(const std::filesystem::path &file, const bool ignore_z_if_zero, const std::vector< std::string > &tetrahedron_attributes)
Definition: input.cpp:12
int8_t right_ear_action(PrimitiveType mesh_type)
Definition: ear_actions.cpp:41
int8_t left_ear_action(PrimitiveType mesh_type)
Definition: ear_actions.cpp:36