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