Wildmeshing Toolkit
SplitNewAttributeTopoInfo.cpp
Go to the documentation of this file.
1 
3 
4 #include <wmtk/utils/Logger.hpp>
5 
8  : m_mesh(m)
9 {}
10 
11 
12 //
13 // void SplitNewAttributeTopoInfo::update_neighboring_simplices(
14 // const ReturnVariant& ret_data,
15 // PrimitiveType pt,
16 // const std::vector<Tuple>& output_simplex) const
17 //{
18 // // default impl is to do nothing
19 //}
20 
21 std::vector<std::array<Tuple, 2>> SplitNewAttributeTopoInfo::input_ear_simplices(
22  const ReturnVariant& ret_data,
23  const Tuple& input_tuple,
24  PrimitiveType pt) const
25 {
26  return input_ear_simplices(std::get<EdgeOperationData>(ret_data), input_tuple, pt);
27 }
28 
29 // the simplices that were created by merging simplices
31  const ReturnVariant& ret_data,
32  const Tuple& output_tuple,
33  PrimitiveType pt) const
34 {
35  return output_rib_simplices(std::get<EdgeOperationData>(ret_data), output_tuple, pt);
36 }
37 std::vector<std::array<Tuple, 2>> SplitNewAttributeTopoInfo::output_split_simplices(
38  const ReturnVariant& ret_data,
39  const Tuple& input_tuple,
40  PrimitiveType pt) const
41 {
42  return output_split_simplices(std::get<EdgeOperationData>(ret_data), input_tuple, pt);
43 }
44 
45 // the simplices that were created by merging simplices
47  const ReturnVariant& ret_data,
48  const Tuple& input_tuple,
49  PrimitiveType pt) const
50 {
51  return input_split_simplices(std::get<EdgeOperationData>(ret_data), input_tuple, pt);
52 }
53 
55  const ReturnVariant& ret_data,
56  PrimitiveType pt) const
57 {
58  return output_duplicated_free_simplices(std::get<EdgeOperationData>(ret_data), pt);
59 }
60 
61 std::vector<std::array<Tuple, 2>> SplitNewAttributeTopoInfo::output_split_simplices(
62  const EdgeOperationData& ret_data,
63  const Tuple& output_tuple,
64  PrimitiveType pt) const
65 {
66  int64_t id = get_primitive_type_id(pt);
67  switch (id) {
68  case 0: {
69  return {};
70  }
71  case 1: {
72  return {ret_data.split_output_edges(m_mesh)};
73  }
74  case 2: {
75  return ret_data.split_output_faces(m_mesh);
76  }
77  default: return {};
78  }
79 }
80 
82  const EdgeOperationData& ret_data,
83  const Tuple& input_tuple,
84  PrimitiveType pt) const
85 {
86  switch (get_primitive_type_id(pt)) {
87  case 0: {
88  return {};
89  }
90  case 1: {
91  return {input_tuple};
92  }
93  case 2: {
94  return ret_data.input_faces(m_mesh);
95  }
96  default: return {};
97  }
98 }
99 
100 std::vector<std::array<Tuple, 2>> SplitNewAttributeTopoInfo::input_ear_simplices(
101  const EdgeOperationData& ret_data,
102  const Tuple& input_tuple,
103  PrimitiveType pt) const
104 {
105  return m_mesh.parent_scope([&]() -> std::vector<std::array<Tuple, 2>> {
106  switch (get_primitive_type_id(pt)) {
107  case 0: {
108  return {ret_data.input_endpoints(m_mesh)};
109  }
110  case 1: {
111  return ret_data.ear_edges(m_mesh);
112  }
113  default: return {};
114  }
115  });
116 }
117 
118 // the simplices that were created by merging simplices
120  const EdgeOperationData& ret_data,
121  const Tuple& output_tuple,
122  PrimitiveType pt) const
123 {
124  switch (get_primitive_type_id(pt)) {
125  case 0: {
126  return {output_tuple};
127  }
128  case 1: {
129  return ret_data.split_new_rib_edges(m_mesh);
130  }
131  default: return {};
132  }
133 }
134 
136  const EdgeOperationData& ret_data,
137  PrimitiveType pt) const
138 {
139  assert(m_mesh.is_free());
140  switch (get_primitive_type_id(pt)) {
141  case 0: {
142  return {
143  ret_data.m_free_split_v,
144  std::array<int64_t, 2>{
145  {ret_data.m_incident_face_datas[0].opposite_vid, ret_data.split_new_vid}}};
146  }
147  case 1: {
148  return {ret_data.m_free_split_e};
149  }
150  default: return {};
151  }
152 }
153 
154 } // namespace wmtk::operations::tri_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::vector< Tuple > input_faces(const TriMesh &) const
std::vector< std::array< Tuple, 2 > > split_output_faces(const TriMesh &) const
std::vector< IncidentFaceData > m_incident_face_datas
std::vector< std::array< Tuple, 2 > > ear_edges(const TriMesh &m) const
std::vector< Tuple > split_new_rib_edges(const TriMesh &) const
std::array< Tuple, 2 > input_endpoints(const TriMesh &m) const
std::array< Tuple, 2 > split_output_edges(const TriMesh &) const
std::vector< std::array< int64_t, 2 > > output_duplicated_free_simplices(const ReturnVariant &ret_data, 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< std::array< Tuple, 2 > > input_ear_simplices(const ReturnVariant &ret_data, const Tuple &input_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
std::vector< Tuple > output_rib_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.