Wildmeshing Toolkit
SplitNewAttributeTopoInfo.cpp
Go to the documentation of this file.
2 
5  : m_mesh(m)
6 {}
7 
8 
9 //
10 // void SplitNewAttributeTopoInfo::update_neighboring_simplices(
11 // const ReturnVariant& ret_data,
12 // PrimitiveType pt,
13 // const std::vector<Tuple>& output_simplex) const
14 //{
15 // // default impl is to do nothing
16 //}
17 
18 std::vector<std::array<Tuple, 2>> SplitNewAttributeTopoInfo::input_ear_simplices(
19  const ReturnVariant& ret_data,
20  const Tuple& input_tuple,
21  PrimitiveType pt) const
22 {
23  return input_ear_simplices(std::get<EdgeOperationData>(ret_data), input_tuple, pt);
24 }
25 
26 // the simplices that were created by merging simplices
28  const ReturnVariant& ret_data,
29  const Tuple& output_tuple,
30  PrimitiveType pt) const
31 {
32  return output_rib_simplices(std::get<EdgeOperationData>(ret_data), output_tuple, pt);
33 }
34 std::vector<std::array<Tuple, 2>> SplitNewAttributeTopoInfo::output_split_simplices(
35  const ReturnVariant& ret_data,
36  const Tuple& input_tuple,
37  PrimitiveType pt) const
38 {
39  return output_split_simplices(std::get<EdgeOperationData>(ret_data), input_tuple, pt);
40 }
41 
42 // the simplices that were created by merging simplices
44  const ReturnVariant& ret_data,
45  const Tuple& input_tuple,
46  PrimitiveType pt) const
47 {
48  return input_split_simplices(std::get<EdgeOperationData>(ret_data), input_tuple, pt);
49 }
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 std::vector<std::array<Tuple, 2>> SplitNewAttributeTopoInfo::output_split_simplices(
59  const EdgeOperationData& ret_data,
60  const Tuple& output_tuple,
61  PrimitiveType pt) const
62 {
63  int64_t id = get_primitive_type_id(pt);
64  switch (id) {
65  case 0: {
66  return {};
67  }
68  case 1: {
69  return {ret_data.split_output_edges(m_mesh)};
70  }
71  case 2: {
72  return ret_data.split_output_faces(m_mesh);
73  }
74  case 3: {
75  return ret_data.split_output_tets(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  case 3: {
97  return ret_data.input_tets(m_mesh);
98  }
99  default: return {};
100  }
101 }
102 
103 std::vector<std::array<Tuple, 2>> SplitNewAttributeTopoInfo::input_ear_simplices(
104  const EdgeOperationData& ret_data,
105  const Tuple& input_tuple,
106  PrimitiveType pt) const
107 {
108  return m_mesh.parent_scope([&]() -> std::vector<std::array<Tuple, 2>> {
109  switch (get_primitive_type_id(pt)) {
110  case 0: {
111  return {ret_data.input_endpoints(m_mesh)};
112  }
113  case 1: {
114  return ret_data.ear_edges(m_mesh);
115  }
116  case 2: {
117  return ret_data.ear_faces(m_mesh);
118  }
119  default: return {};
120  }
121  });
122 }
123 
124 // the simplices that were created by merging simplices
126  const EdgeOperationData& ret_data,
127  const Tuple& output_tuple,
128  PrimitiveType pt) const
129 {
130  switch (get_primitive_type_id(pt)) {
131  case 0: {
132  return {output_tuple};
133  }
134  case 1: {
135  return ret_data.split_new_rib_edges(m_mesh);
136  }
137  case 2: {
138  return ret_data.split_new_rib_faces(m_mesh);
139  }
140  default: return {};
141  }
142 }
144  const EdgeOperationData& ret_data,
145  PrimitiveType pt) const
146 {
147  assert(m_mesh.is_free());
148  // TODO: dont support free tetmeshes yet
149  return {};
150 }
151 } // namespace wmtk::operations::tet_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 TetMesh &m) const
std::vector< std::array< Tuple, 2 > > split_output_faces(const TetMesh &) const
std::vector< std::array< Tuple, 2 > > ear_faces(const TetMesh &m) const
std::vector< Tuple > input_faces(const TetMesh &) const
std::vector< std::array< Tuple, 2 > > ear_edges(const TetMesh &m) const
std::vector< std::array< Tuple, 2 > > split_output_tets(const TetMesh &) const
std::array< Tuple, 2 > split_output_edges(const TetMesh &) const
std::vector< Tuple > input_tets(const TetMesh &) const
std::vector< Tuple > split_new_rib_faces(const TetMesh &) const
std::vector< Tuple > split_new_rib_edges(const TetMesh &) 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 > > output_split_simplices(const ReturnVariant &ret_data, const Tuple &output_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< std::array< Tuple, 2 > > input_ear_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
constexpr int8_t get_primitive_type_id(PrimitiveType t)
Get a unique integer id corresponding to each primitive type.