Wildmeshing Toolkit
EdgeOperationData.cpp
Go to the documentation of this file.
1 
2 #include "EdgeOperationData.hpp"
3 #include <wmtk/TetMesh.hpp>
4 
5 
7 
8 
9 std::vector<std::array<Tuple, 2>> EdgeOperationData::ear_edges(const TetMesh& m) const
10 {
11  std::vector<std::array<Tuple, 2>> ret;
12  ret.reserve(incident_face_datas().size());
13 
14  for (const auto& ifd : incident_face_datas()) {
15  std::array<Tuple, 2>& r = ret.emplace_back();
16 
17  for (size_t j = 0; j < 2; ++j) {
18  int64_t eid = ifd.ear_eids[j];
19  r[j] = tuple_from_id(m, PrimitiveType::Edge, eid);
20  }
21  }
22  return ret;
23 }
24 std::vector<std::array<Tuple, 2>> EdgeOperationData::ear_faces(const TetMesh& m) const
25 {
26  std::vector<std::array<Tuple, 2>> ret;
27  ret.reserve(incident_tet_datas().size());
28 
29  for (const auto& itd : incident_tet_datas()) {
30  std::array<Tuple, 2>& r = ret.emplace_back();
31 
32  for (size_t j = 0; j < 2; ++j) {
33  int64_t fid = itd.ears[j].fid;
34  r[j] = tuple_from_id(m, PrimitiveType::Triangle, fid);
35  }
36  }
37  return ret;
38 }
39 std::array<Tuple, 2> EdgeOperationData::input_endpoints(const TetMesh& m) const
40 {
41  std::array<Tuple, 2> r;
42  r[0] = m_operating_tuple;
44  return r;
45 }
46 
47 std::vector<Tuple> EdgeOperationData::collapse_merged_ear_edges(const TetMesh& m) const
48 {
49  std::vector<Tuple> ret;
50  ret.reserve(incident_face_datas().size());
51 
52  for (const auto& ifd : incident_face_datas()) {
53  ret.emplace_back(tuple_from_id(m, PrimitiveType::Edge, ifd.new_edge_id));
54  }
55  return ret;
56 }
57 
58 std::vector<Tuple> EdgeOperationData::collapse_merged_ear_faces(const TetMesh& m) const
59 {
60  std::vector<Tuple> ret;
61  ret.reserve(incident_tet_datas().size());
62 
63  for (const auto& itd : incident_tet_datas()) {
64  ret.emplace_back(tuple_from_id(m, PrimitiveType::Triangle, itd.new_face_id));
65  }
66  return ret;
67 }
68  std::vector<simplex::Simplex> EdgeOperationData::new_vertices(const Mesh&m) const {
69  if(m.is_free()) {
70  throw std::runtime_error("tet edgeoperationdata new_vertices no implemented for free meshes");
71  return {
72  //simplex_from_id(m,PrimitiveType::Vertex,m_free_split_v[0]),
73  //simplex_from_id(m,PrimitiveType::Vertex,m_free_split_v[1]),
75  };
76  } else {
77  return {
79  };
80  }
81  }
82 
83 std::vector<Tuple> EdgeOperationData::split_new_rib_edges(const TetMesh& m) const
84 {
85  std::vector<Tuple> ret;
86  ret.reserve(incident_face_datas().size());
87 
88  for (const auto& ifd : incident_face_datas()) {
89  ret.emplace_back(tuple_from_id(m, PrimitiveType::Edge, ifd.new_edge_id));
90  }
91  return ret;
92 }
93 
94 std::vector<Tuple> EdgeOperationData::split_new_rib_faces(const TetMesh& m) const
95 {
96  std::vector<Tuple> ret;
97  ret.reserve(incident_tet_datas().size());
98 
99  for (const auto& itd : incident_tet_datas()) {
100  ret.emplace_back(tuple_from_id(m, PrimitiveType::Triangle, itd.new_face_id));
101  }
102  return ret;
103 }
104 
105 std::vector<Tuple> EdgeOperationData::input_faces(const TetMesh& m) const
106 {
107  std::vector<Tuple> ret;
108  ret.reserve(incident_face_datas().size());
109 
110  for (const auto& ifd : incident_face_datas()) {
111  ret.emplace_back(ifd.local_operating_tuple);
112  }
113  return ret;
114 }
115 
116 std::vector<Tuple> EdgeOperationData::input_tets(const TetMesh& m) const
117 {
118  std::vector<Tuple> ret;
119  ret.reserve(incident_tet_datas().size());
120 
121  for (const auto& itd : incident_tet_datas()) {
122  ret.emplace_back(itd.local_operating_tuple);
123  }
124  return ret;
125 }
126 
127 std::array<Tuple, 2> EdgeOperationData::split_output_edges(const TetMesh& m) const
128 {
129  std::array<Tuple, 2> r;
130  for (size_t j = 0; j < 2; ++j) {
132  }
133  return r;
134 }
135 
136 std::vector<std::array<Tuple, 2>> EdgeOperationData::split_output_faces(const TetMesh& m) const
137 {
138  std::vector<std::array<Tuple, 2>> ret;
139  ret.reserve(incident_face_datas().size());
140 
141  for (const auto& ifd : incident_face_datas()) {
142  std::array<Tuple, 2>& r = ret.emplace_back();
143  for (size_t j = 0; j < 2; ++j) {
144  r[j] = tuple_from_id(m, PrimitiveType::Triangle, ifd.split_f[j]);
145  }
146  }
147  return ret;
148 }
149 
150 std::vector<std::array<Tuple, 2>> EdgeOperationData::split_output_tets(const TetMesh& m) const
151 {
152  std::vector<std::array<Tuple, 2>> ret;
153  ret.reserve(incident_tet_datas().size());
154 
155  for (const auto& itd : incident_tet_datas()) {
156  std::array<Tuple, 2>& r = ret.emplace_back();
157  for (size_t j = 0; j < 2; ++j) {
158  r[j] = tuple_from_id(m, PrimitiveType::Tetrahedron, itd.split_t[j]);
159  }
160  }
161  return ret;
162 }
163 
164 
165 } // namespace wmtk::operations::tet_mesh
bool is_free() const
Definition: Mesh.hpp:988
Tuple switch_tuple(const Tuple &tuple, PrimitiveType type) const final override
switch the orientation of the Tuple of the given dimension
Definition: TetMesh.cpp:250
static Tuple tuple_from_id(const Mesh &m, const PrimitiveType type, const int64_t gid)
static simplex::Simplex simplex_from_id(const Mesh &m, const PrimitiveType type, const int64_t gid)
std::array< Tuple, 2 > input_endpoints(const TetMesh &m) const
std::vector< simplex::Simplex > new_vertices(const Mesh &) const
std::vector< Tuple > collapse_merged_ear_faces(const TetMesh &m) const
std::vector< std::array< Tuple, 2 > > split_output_faces(const TetMesh &) const
std::vector< IncidentTetData > incident_tet_datas() 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< IncidentFaceData > incident_face_datas() const
std::vector< Tuple > collapse_merged_ear_edges(const TetMesh &m) 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