Wildmeshing Toolkit
EdgeOperationData.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <array>
3 #include <vector>
4 #include <wmtk/Tuple.hpp>
6 
9 {
10 public:
11  EdgeOperationData() = default;
14  //
15  // E --------------- C --------------- F
16  // \-_ / | \ _-/
17  // \ EarTet / | \ EarTet /
18  // \ tid0 / | \ tid1 /
19  // \ -_/fid0|fid1\_- /
20  // \ / --_ | _-- \ /
21  // \ / __- D -__ \ /
22  // \ /_-- --_\ /
23  // A ================= B
24  // operating edge
25  //
26 
31  struct EarTet
32  {
33  int64_t tid = -1; // global tid of the ear, -1 if it doesn't exist
34  int64_t fid = -1; // global fid of the ear, -1 if it doesn't exist
35  };
36 
37 
38  /*
39  v2
40  /\\
41  ear1 / \ \ ear2
42  / \ \
43  / \ \
44  / \ \
45  / \ \
46  / \ _\ v3
47  /______________\_ -
48  v0 e01 v1
49  */
50 
52  {
53  int64_t fid_old = -1;
54  std::array<int64_t, 2> fid_new = std::array<int64_t, 2>{{-1, -1}};
55  int64_t eid_spine_old = -1;
56  std::array<int64_t, 2> eid_spine_new = std::array<int64_t, 2>{{-1, -1}};
57  int64_t eid_rib = -1; // eid_split
58 
60  };
61 
63  {
64  };
65 
70  {
71  // merging split data and collapse data
72  int64_t tid = -1;
73 
74  std::array<int64_t, 2> split_t = std::array<int64_t, 2>{{-1, -1}}; // tid_new_1/2
75  int64_t rib_f = -1; // fid_split
76 
77  int64_t v0 = -1;
78  int64_t v1 = -1;
79  int64_t v2 = -1;
80  int64_t v3 = -1;
81  int64_t e01 = -1;
82  int64_t e02 = -1;
83  int64_t e03 = -1;
84  int64_t e12 = -1;
85  int64_t e13 = -1;
86  int64_t e23 = -1;
87 
88  std::array<EarTet, 2> ears; // ear_tet_1/2
89 
90  std::array<FaceSplitData, 2> new_face_data; // this is used for connnectivity update
91 
92  std::array<int64_t, 2> incident_face_data_idx = std::array<int64_t, 2>{{-1, -1}};
93 
94  std::array<int, 2> incident_face_local_fid = std::array<int, 2>{{-1, -1}};
95 
96  // should = split_f, new rib face for split or face merging two ears by collapse
97  int64_t new_face_id = -1;
98 
100 
101  // only used for collapse multimesh update
102  int64_t merged_face_tid = -1;
103  };
104 
106  {
107  int64_t fid = -1;
108  std::array<int64_t, 2> ear_eids = std::array<int64_t, 2>{{-1, -1}};
109  int64_t new_edge_id = -1; // new rib edge for split or edge merging two ears by collapse
110  std::array<int64_t, 2> split_f = std::array<int64_t, 2>{{-1, -1}};
111 
113  };
114 
115 
116  const std::array<int64_t, 2>& incident_vids() const { return m_spine_vids; }
117 
118  int64_t operating_edge_id() const { return m_operating_edge_id; }
119 
120 
121  std::array<std::vector<int64_t>, 4> simplex_ids_to_delete;
122  std::array<std::vector<Tuple>, 4> simplex_tuples_to_delete;
123  std::vector<int64_t> cell_ids_to_update_hash;
124 
125 
126  // only returns valid tuples for the state before an operation occurred
127  std::vector<std::array<Tuple, 2>> ear_edges(const TetMesh& m) const;
128  std::vector<std::array<Tuple, 2>> ear_faces(const TetMesh& m) const;
129  std::array<Tuple, 2> input_endpoints(const TetMesh& m) const;
130  std::vector<Tuple> collapse_merged_ear_edges(const TetMesh& m) const;
131  std::vector<Tuple> collapse_merged_ear_faces(const TetMesh& m) const;
132  std::vector<Tuple> split_new_rib_edges(const TetMesh&) const;
133  std::vector<Tuple> split_new_rib_faces(const TetMesh&) const;
134  std::vector<Tuple> input_tets(const TetMesh&) const;
135  std::vector<Tuple> input_faces(const TetMesh&) const;
136  std::array<Tuple, 2> split_output_edges(const TetMesh&) const;
137  std::vector<std::array<Tuple, 2>> split_output_faces(const TetMesh&) const;
138  std::vector<std::array<Tuple, 2>> split_output_tets(const TetMesh&) const;
139 
140  std::vector<IncidentTetData> incident_tet_datas() const { return m_incident_tet_datas; }
141  std::vector<IncidentFaceData> incident_face_datas() const { return m_incident_face_datas; }
142 
143  std::vector<simplex::Simplex> new_vertices(const Mesh&) const;
144  std::array<int64_t, 2> new_spine_eids() const { return m_split_new_spine_eids; }
145 
146 
147  bool is_collapse = false;
148 
149 
150 protected:
151  // common simplices
152  std::array<int64_t, 2> m_spine_vids; // two endpoints of the edge
156 
157  int64_t m_split_new_vid = -1;
158  std::array<int64_t, 2> m_split_new_spine_eids;
159 
160  // simplices required per-tet
161  std::vector<IncidentTetData> m_incident_tet_datas;
162  std::vector<IncidentFaceData> m_incident_face_datas;
163 };
164 } // namespace wmtk::operations::tet_mesh
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::array< std::vector< Tuple >, 4 > simplex_tuples_to_delete
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::array< std::vector< int64_t >, 4 > simplex_ids_to_delete
const std::array< int64_t, 2 > & incident_vids() const
std::array< int64_t, 2 > new_spine_eids() 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
EdgeOperationData(EdgeOperationData &&)=default
std::vector< IncidentFaceData > incident_face_datas() const
EdgeOperationData & operator=(EdgeOperationData &&)=default
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< IncidentTetData > m_incident_tet_datas
std::vector< IncidentFaceData > m_incident_face_datas
std::vector< Tuple > split_new_rib_edges(const TetMesh &) const
An EarTet is a neighbor of a tet to be deleted in the split/collapse operation.
Data on the incident tets of the operating edge.