Wildmeshing Toolkit
CollapseNewAttributeTopoInfo.cpp
Go to the documentation of this file.
2 
3 
5 
6 
8  : m_mesh(m)
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  default: return {};
48  }
49  });
50 }
51 
52 // the simplices that were created by merging simplices
54  const EdgeOperationData& ret_data,
55  const Tuple& output_tuple,
56  PrimitiveType pt) const
57 {
58  switch (get_primitive_type_id(pt)) {
59  case 0: {
60  return {output_tuple};
61  }
62  default: return {};
63  }
64 }
65 
66 } // namespace wmtk::operations::edge_mesh
decltype(auto) parent_scope(Functor &&f, Args &&... args) const
Evaluate the passed in function inside the parent scope.
std::vector< Tuple > new_simplices(const ReturnVariant &ret_data, const Tuple &input_tuple, PrimitiveType pt) const final override
std::vector< std::array< Tuple, 2 > > merged_simplices(const ReturnVariant &ret_data, const Tuple &input_tuple, PrimitiveType pt) const final override
std::array< Tuple, 2 > input_endpoints(const EdgeMesh &m) const
constexpr int8_t get_primitive_type_id(PrimitiveType t)
Get a unique integer id corresponding to each primitive type.