Wildmeshing Toolkit
SplitNewAttributeTopoInfo.cpp
Go to the documentation of this file.
1 
3 
5 
7  : m_mesh(m)
8 {}
9 
10 //
11 // void SplitNewAttributeTopoInfo::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>> SplitNewAttributeTopoInfo::input_ear_simplices(
20  const ReturnVariant& ret_data,
21  const Tuple& input_tuple,
22  PrimitiveType pt) const
23 {
24  return input_ear_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 output_rib_simplices(std::get<EdgeOperationData>(ret_data), output_tuple, pt);
34 }
35 std::vector<std::array<Tuple, 2>> SplitNewAttributeTopoInfo::output_split_simplices(
36  const ReturnVariant& ret_data,
37  const Tuple& input_tuple,
38  PrimitiveType pt) const
39 {
40  return output_split_simplices(std::get<EdgeOperationData>(ret_data), input_tuple, pt);
41 }
42 
43 // the simplices that were created by merging simplices
45  const ReturnVariant& ret_data,
46  const Tuple& input_tuple,
47  PrimitiveType pt) const
48 {
49  return input_split_simplices(std::get<EdgeOperationData>(ret_data), input_tuple, pt);
50 }
51 
53  const ReturnVariant& ret_data,
54  PrimitiveType pt) const
55 {
56  return output_duplicated_free_simplices(std::get<EdgeOperationData>(ret_data), pt);
57 }
58 
59 std::vector<std::array<Tuple, 2>> SplitNewAttributeTopoInfo::output_split_simplices(
60  const EdgeOperationData& ret_data,
61  const Tuple& output_tuple,
62  PrimitiveType pt) const
63 {
64  int64_t id = get_primitive_type_id(pt);
65 
66  switch (id) {
67  case 0: {
68  return {};
69  }
70  case 1: {
71  return {ret_data.split_output_edges(m_mesh)};
72  }
73  default: return {};
74  }
75 }
76 
78  const EdgeOperationData& ret_data,
79  const Tuple& input_tuple,
80  PrimitiveType pt) const
81 {
82  switch (get_primitive_type_id(pt)) {
83  case 1: {
84  return {input_tuple};
85  }
86  default: return {};
87  }
88 }
89 
90 std::vector<std::array<Tuple, 2>> SplitNewAttributeTopoInfo::input_ear_simplices(
91  const EdgeOperationData& ret_data,
92  const Tuple& input_tuple,
93  PrimitiveType pt) const
94 {
95  return m_mesh.parent_scope([&]() -> std::vector<std::array<Tuple, 2>> {
96  switch (get_primitive_type_id(pt)) {
97  case 0: {
98  return {ret_data.input_endpoints(m_mesh)};
99  }
100  default: return {};
101  }
102  });
103 }
104 
105 // the simplices that were created by merging simplices
107  const EdgeOperationData& ret_data,
108  const Tuple& output_tuple,
109  PrimitiveType pt) const
110 {
111  switch (get_primitive_type_id(pt)) {
112  case 0: {
113  return {output_tuple};
114  }
115  default: return {};
116  }
117 }
118 
120  const EdgeOperationData& ret_data,
121  PrimitiveType pt) const
122 {
123  assert(m_mesh.is_free());
124  switch (get_primitive_type_id(pt)) {
125  case 0: {
126  return {ret_data.m_free_split_v};
127  }
128  case 1: {
129  return {};
130  }
131  default: return {};
132  }
133 }
134 
135 } // namespace wmtk::operations::edge_mesh
bool is_free() const
Definition: Mesh.hpp:988
decltype(auto) parent_scope(Functor &&f, Args &&... args) const
Evaluate the passed in function inside the parent scope.
std::array< Tuple, 2 > input_endpoints(const EdgeMesh &m) const
std::array< Tuple, 2 > split_output_edges(const EdgeMesh &) const
std::vector< std::array< int64_t, 2 > > output_duplicated_free_simplices(const ReturnVariant &ret_data, PrimitiveType pt) const final override
std::vector< std::array< Tuple, 2 > > input_ear_simplices(const ReturnVariant &ret_data, const Tuple &input_tuple, PrimitiveType pt) const final override
std::vector< Tuple > input_split_simplices(const ReturnVariant &ret_data, const Tuple &input_tuple, PrimitiveType pt) const final override
std::vector< Tuple > output_rib_simplices(const ReturnVariant &ret_data, const Tuple &output_tuple, PrimitiveType pt) const final override
std::vector< std::array< Tuple, 2 > > output_split_simplices(const ReturnVariant &ret_data, const Tuple &output_tuple, PrimitiveType pt) const final override
constexpr int8_t get_primitive_type_id(PrimitiveType t)
Get a unique integer id corresponding to each primitive type.