Wildmeshing Toolkit
CollapseNewAttributeTopoInfo.cpp
Go to the documentation of this file.
2 
3 
5 
6 
8  : m_mesh(m)
9 {}
10 
11 //
12 // void CollapseNewAttributeTopoInfo::update_neighboring_simplices(
13 // const ReturnVariant& ret_data,
14 // PrimitiveType pt,
15 // const std::vector<Tuple>& output_simplex) const
16 //{
17 // // default impl is to do nothing
18 //}
19 
20 std::vector<std::array<Tuple, 2>> CollapseNewAttributeTopoInfo::merged_simplices(
21  const ReturnVariant& ret_data,
22  const Tuple& input_tuple,
23  PrimitiveType pt) const
24 {
25  return merged_simplices(std::get<EdgeOperationData>(ret_data), input_tuple, pt);
26 }
27 
28 // the simplices that were created by merging simplices
30  const ReturnVariant& ret_data,
31  const Tuple& output_tuple,
32  PrimitiveType pt) const
33 {
34  return new_simplices(std::get<EdgeOperationData>(ret_data), output_tuple, pt);
35 }
36 
37 // the sipmlices that were merged together
38 std::vector<std::array<Tuple, 2>> CollapseNewAttributeTopoInfo::merged_simplices(
39  const EdgeOperationData& ret_data,
40  const Tuple& input_tuple,
41  PrimitiveType pt) const
42 {
43  return m_mesh.parent_scope([&]() -> std::vector<std::array<Tuple, 2>> {
44  switch (get_primitive_type_id(pt)) {
45  case 0: {
46  return {ret_data.input_endpoints(m_mesh)};
47  }
48  case 1: {
49  return ret_data.ear_edges(m_mesh);
50  }
51  default: return {};
52  }
53  });
54 }
55 
56 // the simplices that were created by merging simplices
58  const EdgeOperationData& ret_data,
59  const Tuple& output_tuple,
60  PrimitiveType pt) const
61 {
62  switch (get_primitive_type_id(pt)) {
63  case 0: {
64  return {output_tuple};
65  }
66  case 1: {
67  return ret_data.collapse_merged_ear_edges(m_mesh);
68  }
69  default: return {};
70  }
71 }
72 
73 } // namespace wmtk::operations::tri_mesh
decltype(auto) parent_scope(Functor &&f, Args &&... args) const
Evaluate the passed in function inside the parent scope.
std::vector< std::array< Tuple, 2 > > merged_simplices(const ReturnVariant &ret_data, const Tuple &input_tuple, PrimitiveType pt) const final override
std::vector< Tuple > new_simplices(const ReturnVariant &ret_data, const Tuple &input_tuple, PrimitiveType pt) const final override
std::vector< Tuple > collapse_merged_ear_edges(const TriMesh &m) const
std::vector< std::array< Tuple, 2 > > ear_edges(const TriMesh &m) const
std::array< Tuple, 2 > input_endpoints(const TriMesh &m) const
constexpr int8_t get_primitive_type_id(PrimitiveType t)
Get a unique integer id corresponding to each primitive type.