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