3#include <wmtk/utils/VectorUtils.h>
5#include <wmtk/AttributeCollection.hpp>
6#include <wmtk/Types.hpp>
7#include <wmtk/simplex/RawSimplex.hpp>
8#include <wmtk/utils/Logger.hpp>
10#include <tbb/concurrent_vector.h>
11#include <tbb/enumerable_thread_specific.h>
12#include <tbb/spin_mutex.h>
31 {{{0, 1}}, {{1, 2}}, {{0, 2}}, {{0, 3}}, {{1, 3}}, {{2, 3}}}};
33 static constexpr std::array<int, 4> m_map_vertex2edge = {{0, 0, 1, 3}};
34 static constexpr std::array<int, 4> m_map_vertex2oppo_face = {{3, 1, 2, 0}};
35 static constexpr std::array<int, 6> m_map_edge2face = {{0, 0, 0, 1, 2, 1}};
36 static constexpr std::array<std::array<int, 3>, 4> m_local_faces = {
37 {{{0, 1, 2}}, {{0, 2, 3}}, {{0, 1, 3}}, {{1, 2, 3}}}};
38 static constexpr std::array<std::array<int, 3>, 4> m_local_edges_in_a_face = {
39 {{{0, 1, 2}}, {{2, 5, 3}}, {{3, 4, 0}}, {{5, 1, 4}}}};
50 size_t m_global_vid = std::numeric_limits<size_t>::max();
51 size_t m_local_eid = std::numeric_limits<size_t>::max();
52 size_t m_local_fid = std::numeric_limits<size_t>::max();
53 size_t m_global_tid = std::numeric_limits<size_t>::max();
174 std::optional<Tuple> switch_tetrahedron_slow(
const TetMesh& m)
const;
182 friend bool operator==(
const Tuple& a,
const Tuple& t)
185 std::tie(a.m_global_vid, a.m_local_eid, a.m_local_fid, a.m_global_tid, a.m_hash) ==
186 std::tie(t.m_global_vid, t.m_local_eid, t.m_local_fid, t.m_global_tid, t.m_hash));
188 friend bool operator<(
const Tuple& a,
const Tuple& t)
191 std::tie(a.m_global_vid, a.m_local_eid, a.m_local_fid, a.m_global_tid, a.m_hash) <
192 std::tie(t.m_global_vid, t.m_local_eid, t.m_local_fid, t.m_global_tid, t.m_hash));
211 const Tuple& tuple() {
return m_tuple; }
212 const TetMesh& mesh() {
return m_mesh; }
220 bool is_valid()
const {
return m_tuple.
is_valid(m_mesh); }
223 size_t vid()
const {
return m_tuple.
vid(m_mesh); }
224 size_t eid()
const {
return m_tuple.
eid(m_mesh); }
225 size_t fid()
const {
return m_tuple.
fid(m_mesh); }
226 size_t tid()
const {
return m_tuple.
tid(m_mesh); }
230 std::optional<SmartTuple> switch_tetrahedron()
const
234 return std::optional<SmartTuple>({m_mesh, t.value()});
238 void check_validity()
const {
return m_tuple.
check_validity(m_mesh); }
249 std::vector<size_t> m_conn_tets;
250 bool m_is_removed =
false;
252 size_t& operator[](
const size_t index)
254 assert(index < m_conn_tets.size());
255 return m_conn_tets[index];
258 size_t operator[](
const size_t index)
const
260 assert(index < m_conn_tets.size());
261 return m_conn_tets[index];
266 return std::tie(l.m_conn_tets, l.m_is_removed) ==
267 std::tie(r.m_conn_tets, r.m_is_removed);
280 std::array<size_t, 4> m_indices;
281 bool m_is_removed =
false;
285 size_t& operator[](
size_t index)
288 return m_indices[index];
291 size_t operator[](
size_t index)
const
294 return m_indices[index];
297 int find(
size_t v_id)
const
299 for (
int j = 0; j < 4; j++) {
300 if (v_id == m_indices[j])
return j;
305 int find_local_edge(
size_t v1_id,
size_t v2_id)
const
307 std::array<int, 2> e;
308 for (
int j = 0; j < 4; j++) {
309 if (v1_id == m_indices[j])
311 else if (v2_id == m_indices[j])
314 if (e[0] > e[1]) std::swap(e[0], e[1]);
321 int find_local_face(
size_t v1_id,
size_t v2_id,
size_t v3_id)
const
323 std::array<int, 3> f;
324 for (
int j = 0; j < 4; j++) {
325 if (v1_id == m_indices[j])
327 else if (v2_id == m_indices[j])
329 else if (v3_id == m_indices[j])
332 std::sort(f.begin(), f.end());
334 std::find(m_local_faces.begin(), m_local_faces.end(), f) - m_local_faces.begin();
341 return std::tie(l.m_indices, l.m_is_removed, l.hash) ==
342 std::tie(r.m_indices, r.m_is_removed, r.hash);
371 if (!m_vertex_connectivity[i].m_is_removed) cnt++;
383 if (!m_tet_connectivity[i].m_is_removed) cnt++;
396 void init(
size_t n_vertices,
const std::vector<std::array<size_t, 4>>& tets);
397 void init_with_isolated_vertices(
399 const std::vector<std::array<size_t, 4>>& tets);
406 void init(
const MatrixXi& T);
415 bool split_edge(
const Tuple& t, std::vector<Tuple>& new_tets);
423 virtual bool collapse_edge(
const Tuple& t, std::vector<Tuple>& new_tets);
446 std::vector<Tuple>& new_edges,
449 std::map<size_t, wmtk::TetMesh::VertexConnectivity>& rollback_vert_conn,
450 std::vector<size_t>& n1_t_ids_copy,
451 std::vector<size_t>& new_tet_id,
452 std::vector<TetrahedronConnectivity>& old_tets);
478 std::map<size_t, wmtk::TetMesh::VertexConnectivity>& rollback_vert_conn,
479 std::vector<size_t>& n1_t_ids,
480 std::vector<size_t>& new_tet_id,
481 std::vector<TetrahedronConnectivity>& old_tets);
491 bool swap_edge_56(
const Tuple& t, std::vector<Tuple>& new_tets);
500 bool swap_edge_44(
const Tuple& t, std::vector<Tuple>& new_tets);
509 bool swap_edge(
const Tuple& t, std::vector<Tuple>& new_tets);
516 bool swap_face(
const Tuple& t, std::vector<Tuple>& new_tets);
534 bool split_tet(
const Tuple& t, std::vector<Tuple>& new_tets);
546 bool split_face(
const Tuple& t, std::vector<Tuple>& new_tets);
556 const std::vector<Tuple>& intersected_tets,
557 const std::vector<Tuple>& intersected_edges,
558 std::vector<size_t>& new_edge_vids,
559 std::vector<size_t>& new_center_vids,
560 std::vector<std::array<size_t, 4>>& center_split_tets);
571 bool insert_point(
const Tuple& t, std::vector<Tuple>& new_tets);
572 virtual bool insert_point_before(
const Tuple& t) {
return true; };
573 virtual bool insert_point_after(std::vector<Tuple>& new_tets) {
return true; };
604 std::vector<Tuple>
get_tets()
const;
616 virtual void for_each_face(
const std::function<
void(
const TetMesh::Tuple&)>&);
629 template <
typename T>
630 using vector = tbb::concurrent_vector<T>;
633 AbstractAttributeContainer* p_vertex_attrs =
nullptr;
634 AbstractAttributeContainer* p_edge_attrs =
nullptr;
635 AbstractAttributeContainer* p_face_attrs =
nullptr;
636 AbstractAttributeContainer* p_tet_attrs =
nullptr;
642 vector<VertexConnectivity> m_vertex_connectivity;
643 vector<TetrahedronConnectivity> m_tet_connectivity;
644 std::atomic_long current_vert_size;
645 std::atomic_long current_tet_size;
646 tbb::spin_mutex vertex_connectivity_lock;
647 tbb::spin_mutex tet_connectivity_lock;
648 bool vertex_connectivity_synchronizing_flag =
false;
649 bool tet_connectivity_synchronizing_flag =
false;
650 int MAX_THREADS = 128;
652 int m_t_empty_slot = 0;
653 int m_v_empty_slot = 0;
654 int get_next_empty_slot_t();
655 int get_next_empty_slot_v();
659 const std::vector<size_t> t_ids,
660 const std::vector<bool>& mark_surface,
661 const std::map<std::array<size_t, 2>,
size_t>& map_edge2vid,
662 std::map<std::array<size_t, 3>, std::vector<std::array<size_t, 5>>>& new_face_vids,
663 const std::vector<size_t>& new_vids,
664 std::vector<size_t>& new_tids,
665 std::vector<size_t>& new_center_vids,
666 std::vector<std::array<size_t, 4>>& center_split_tets);
669 const std::array<int, 6>& new_v_ids,
671 std::map<std::array<size_t, 3>, std::vector<std::array<size_t, 5>>>& new_face_vids,
672 std::vector<size_t>& new_tids,
673 std::vector<size_t>& new_center_vids,
674 std::vector<std::array<size_t, 4>>& center_split_tets);
677 virtual bool invariants(
const std::vector<Tuple>&) {
return true; }
680 virtual bool triangle_insertion_before(
const std::vector<Tuple>& faces) {
return true; }
681 virtual bool triangle_insertion_after(
const std::vector<std::vector<Tuple>>&) {
return true; }
740 const std::vector<std::array<size_t, 4>>& tets,
771 const std::vector<std::array<size_t, 4>>& tets,
892 std::tuple<Tuple, size_t>
tuple_from_face(
const std::array<size_t, 3>& vids)
const;
913 Tuple
tuple_from_vids(
size_t vid0,
size_t vid1,
size_t vid2,
size_t vid3)
const;
950 auto loc = t.switch_tetrahedron(*
this);
1013 std::vector<size_t> get_incident_tids_for_edge(
const Tuple& t)
const;
1014 std::vector<size_t> get_incident_tids_for_edge(
const size_t vid0,
const size_t vid1)
const;
1049 std::array<size_t, 3> get_face_vids(
const Tuple& t)
const;
1058 std::array<Tuple, 6>
tet_edges(
const Tuple& t)
const;
1077 for (
size_t tid : tids) {
1078 m_tet_connectivity[tid].m_is_removed =
true;
1079 for (
int j = 0; j < 4; j++)
1080 vector_erase(m_vertex_connectivity[m_tet_connectivity[tid][j]].m_conn_tets, tid);
1082 for (
auto& v : m_vertex_connectivity) {
1083 if (v.m_is_removed)
continue;
1084 if (v.m_conn_tets.empty()) v.m_is_removed =
true;
1087 bool m_collapse_check_link_condition =
true;
1088 bool m_collapse_check_topology =
false;
1089 bool m_collapse_check_manifold =
true;
1093 std::vector<size_t>& affected_tid,
1094 const std::vector<std::array<size_t, 4>>& new_tet_conn);
1095 void operation_failure_rollback_imp(
1096 std::map<size_t, VertexConnectivity>& rollback_vert_conn,
1097 const std::vector<size_t>& affected,
1098 const std::vector<size_t>& new_tet_id,
1099 const std::vector<TetrahedronConnectivity>& old_tets);
1101 const std::vector<size_t>& remove_id,
1102 const std::vector<std::array<size_t, 4>>& new_tet_conn,
1103 std::vector<size_t>& allocate_id);
1104 static std::vector<TetrahedronConnectivity> record_old_tet_connectivity(
1105 const TetMesh::vector<TetrahedronConnectivity>& conn,
1106 const std::vector<size_t>& tets)
1108 std::vector<TetrahedronConnectivity> tet_conn;
1109 for (
size_t i : tets) {
1110 tet_conn.push_back(conn[i]);
1116 void start_protect_attributes()
1118 if (p_vertex_attrs) {
1119 p_vertex_attrs->begin_protect();
1122 p_edge_attrs->begin_protect();
1125 p_face_attrs->begin_protect();
1128 p_tet_attrs->begin_protect();
1132 void release_protect_attributes()
1134 if (p_vertex_attrs) {
1135 p_vertex_attrs->end_protect();
1138 p_edge_attrs->end_protect();
1141 p_face_attrs->end_protect();
1144 p_tet_attrs->end_protect();
1148 void rollback_protected_attributes()
1150 if (p_vertex_attrs) {
1151 p_vertex_attrs->rollback();
1154 p_edge_attrs->rollback();
1157 p_face_attrs->rollback();
1160 p_tet_attrs->rollback();
1167 tbb::spin_mutex mutex;
1168 int owner = std::numeric_limits<int>::max();
1171 bool trylock() {
return mutex.try_lock(); }
1179 int get_owner() {
return owner; }
1181 void set_owner(
int n) { owner = n; }
1183 void reset_owner() { owner = INT_MAX; }
1187 tbb::concurrent_vector<VertexMutex> m_vertex_mutex;
1189 bool try_set_vertex_mutex(
const Tuple& v,
int threadid)
1191 bool got = m_vertex_mutex[v.vid(*
this)].trylock();
1192 if (got) m_vertex_mutex[v.vid(*
this)].set_owner(threadid);
1195 bool try_set_vertex_mutex(
size_t vid,
int threadid)
1197 bool got = m_vertex_mutex[vid].trylock();
1198 if (got) m_vertex_mutex[vid].set_owner(threadid);
1202 void unlock_vertex_mutex(
const Tuple& v) { m_vertex_mutex[v.vid(*
this)].unlock(); }
1203 void unlock_vertex_mutex(
size_t vid) { m_vertex_mutex[vid].unlock(); }
1206 void resize_vertex_mutex(
size_t v) { m_vertex_mutex.grow_to_at_least(v); }
1209 tbb::enumerable_thread_specific<std::vector<size_t>> mutex_release_stack;
1210 tbb::enumerable_thread_specific<std::vector<size_t>> get_one_ring_cache;
1213 int release_vertex_mutex_in_stack();
1301 void for_each_edge(
const std::function<
void(
const TetMesh::Tuple&)>&);
1306 void for_each_vertex(
const std::function<
void(
const TetMesh::Tuple&)>&);
1311 void for_each_tetra(
const std::function<
void(
const TetMesh::Tuple&)>&);
1312 int NUM_THREADS = 0;
a Tuple refers to a global vid and a global tet id, and a local edge id and local face id
Definition TetMesh.h:49
Tuple switch_face(const TetMesh &m) const
Definition TetMeshTuple.cpp:253
bool is_valid(const TetMesh &m) const
Definition TetMeshTuple.cpp:57
bool is_boundary_face(const TetMesh &m) const
Definition TetMeshTuple.cpp:17
void print_info() const
prints the tuple
Definition TetMeshTuple.cpp:68
std::optional< Tuple > switch_tetrahedron(const TetMesh &m) const
Definition TetMeshTuple.cpp:273
size_t eid(const TetMesh &m) const
Definition TetMeshTuple.cpp:111
Tuple switch_edge(const TetMesh &m) const
Definition TetMeshTuple.cpp:238
Tuple switch_vertex(const TetMesh &m) const
Definition TetMeshTuple.cpp:224
size_t tid(const TetMesh &m) const
Definition TetMeshTuple.cpp:219
size_t vid(const TetMesh &m) const
Definition TetMeshTuple.cpp:106
size_t fid(const TetMesh &m) const
Definition TetMeshTuple.cpp:131
bool is_boundary_edge(const TetMesh &m) const
Definition TetMeshTuple.cpp:34
void check_validity(const TetMesh &m) const
check Tuple validity and connectivity validity
Definition TetMeshTuple.cpp:358
Definition TetMesh.h:1166
virtual bool swap_edge_44_after(const Tuple &t)
User specified modifications and desideratas for after a 4-4 edge swap.
Definition TetMesh.h:751
std::vector< Tuple > get_one_ring_vertices_for_vertex(const Tuple &t) const
Get the one ring vertices for a vertex.
Definition TetMesh.cpp:712
virtual bool swap_edge_44_before(const Tuple &t)
User specified preparations and desideratas for an 4-4 edge swap before changing the connectivity.
Definition TetMesh.h:728
virtual bool split_tet_before(const Tuple &t)
User specified preparations and desideratas for a tet split before changing the connectivity.
Definition TetMesh.h:851
size_t tet_size() const
get the number of unremoved tets
Definition TetMesh.h:379
std::vector< Tuple > get_faces() const
Definition TetMesh.cpp:219
std::array< Tuple, 6 > tet_edges(const Tuple &t) const
get the 6 edges of a tet represented by Tuples
Definition TetMesh.cpp:677
virtual bool smooth_after(const Tuple &t)
User specified modifications and desideratas for after smoothing a vertex.
Definition TetMesh.h:826
void consolidate_mesh()
cleans up the deleted vertices or tetrahedra, fixes the corresponding indices, and reset the version ...
Definition TetMesh.cpp:836
size_t vert_capacity() const
get the current largest global vid
Definition TetMesh.h:355
virtual bool collapse_edge_after(const Tuple &t)
User specified modifications and desideratas for after an edge collapse.
Definition TetMesh.h:720
virtual bool swap_edge_after(const Tuple &t)
User specified modifications and desideratas for after a 3-2 edge swap.
Definition TetMesh.h:797
bool smooth_vertex(const Tuple &t)
Definition TetMesh.cpp:339
bool insert_point(const Tuple &t, std::vector< Tuple > &new_tets)
Insert a point into a tetmesh inside a tet. In general position, this split a tet into 4....
Definition TetMeshTriangleInsertionConn.cpp:412
bool split_edge(const Tuple &t, std::vector< Tuple > &new_tets)
Definition TetMeshEdgeSplittingConn.cpp:6
Tuple switch_face(const Tuple &t) const
wrapper function from Tuple::switch_face
Definition TetMesh.h:939
std::array< Tuple, 4 > oriented_tet_vertices(const Tuple &t) const
Definition TetMesh.cpp:637
void for_each_vertex(const std::function< void(const TetMesh::Tuple &)> &)
perform the given function for each vertex
Definition TetMesh.cpp:1355
bool try_set_vertex_mutex_one_ring(const Tuple &v, int threadid=0)
try lock the one-ring neighboring traingles' incident vertices
Definition TetMesh.cpp:1269
std::array< size_t, 4 > oriented_tet_vids(const Tuple &t) const
Definition TetMesh.cpp:649
bool collapse_edge_check_topology(const std::vector< size_t > &new_tet_id)
Check topology after collapse connectivity change. This is a sanity check and should not be necessary...
Definition TetMeshEdgeCollapsingConn.cpp:419
bool try_set_vertex_mutex_two_ring_vid(const Tuple &v, int threadid)
try lock the two-ring neighboring traingles' incident vertices using vids
Definition TetMesh.cpp:974
Tuple tuple_from_tet(size_t tid) const
get a Tuple from global tetra index
Definition TetMesh.cpp:580
void subdivide_tets(const std::vector< size_t > t_ids, const std::vector< bool > &mark_surface, const std::map< std::array< size_t, 2 >, size_t > &map_edge2vid, std::map< std::array< size_t, 3 >, std::vector< std::array< size_t, 5 > > > &new_face_vids, const std::vector< size_t > &new_vids, std::vector< size_t > &new_tids, std::vector< size_t > &new_center_vids, std::vector< std::array< size_t, 4 > > ¢er_split_tets)
Definition TetMeshTriangleInsertionConn.cpp:141
void init(size_t n_vertices, const std::vector< std::array< size_t, 4 > > &tets)
Definition TetMesh.cpp:77
void subdivide_a_tet(size_t t_id, const std::array< int, 6 > &new_v_ids, bool mark_surface, std::map< std::array< size_t, 3 >, std::vector< std::array< size_t, 5 > > > &new_face_vids, std::vector< size_t > &new_tids, std::vector< size_t > &new_center_vids, std::vector< std::array< size_t, 4 > > ¢er_split_tets)
Definition TetMeshTriangleInsertionConn.cpp:234
virtual bool swap_edge_56_before(const Tuple &t)
User specified preparations and desideratas for a 5-6 edge swap before changing the connectivity.
Definition TetMesh.h:759
std::vector< Tuple > get_incident_tets_for_edge(const Tuple &t) const
Get the incident tets for edge.
Definition TetMesh.cpp:781
virtual bool split_face_after(const Tuple &t)
Compute the attributes for the added simplices.
Definition TetMesh.h:843
bool swap_edge_56(const Tuple &t, std::vector< Tuple > &new_tets)
Definition TetMeshSwapMeshConnectivity.cpp:690
bool split_face(const Tuple &t, std::vector< Tuple > &new_tets)
Split a face in 3 faces.
Definition TetMeshFaceSplittingConn.cpp:6
bool link_condition(const Tuple &t)
Definition TetMeshEdgeCollapsingConn.cpp:310
std::vector< Tuple > get_one_ring_tets_for_edge(const Tuple &t) const
Get the one ring tets for edge.
Definition TetMesh.cpp:816
virtual bool split_face_before(const Tuple &t)
User specified preparations and desideratas for a face split before changing the connectivity.
Definition TetMesh.h:834
virtual double swap_edge_44_energy(const std::vector< std::array< size_t, 4 > > &tets, const int op_case)
User specified energy to decide which of the 4 possible orientations should be chosen.
Definition TetMesh.h:739
Tuple tuple_from_vertex(size_t vid) const
get a Tuple from global vertex index
Definition TetMesh.cpp:567
virtual void for_each_face(const std::function< void(const TetMesh::Tuple &)> &)
looping through all the unique edges and perform the given function
Definition TetMesh.cpp:205
std::vector< size_t > get_one_ring_vids_for_vertex(size_t vid, std::vector< size_t > &cache)
Get the one ring vids for vertex.
Definition TetMesh.cpp:757
std::optional< Tuple > switch_tetrahedron(const Tuple &t) const
wrapper function from Tuple::switch_tetrahedron
Definition TetMesh.h:948
std::vector< Tuple > get_tets() const
Definition TetMesh.cpp:308
virtual bool smooth_before(const Tuple &t)
User specified preparations and desideratas for smoothing a vertex.
Definition TetMesh.h:819
virtual bool split_edge_before(const Tuple &t)
User specified preparations and desideratas for an edge split before changing the connectivity.
Definition TetMesh.h:691
std::vector< size_t > get_one_ring_vids_for_vertex_adj(size_t vid) const
Duplicate of the function TetMesh::get_one_ring_vids_for_vertex.
Definition TetMesh.cpp:743
virtual bool swap_edge_before(const Tuple &t)
User specified preparations and desideratas for an 3-2 edge swap before changing the conenctivity.
Definition TetMesh.h:790
void triangle_insertion(const std::vector< Tuple > &intersected_tets, const std::vector< Tuple > &intersected_edges, std::vector< size_t > &new_edge_vids, std::vector< size_t > &new_center_vids, std::vector< std::array< size_t, 4 > > ¢er_split_tets)
Insert a triangle into a tetmesh, with known intersection information.
Definition TetMeshTriangleInsertionConn.cpp:11
bool check_mesh_connectivity_validity() const
checks the validity of the connectivity of the mesh. Including the validity of each Tuple
Definition TetMesh.cpp:234
bool split_tet(const Tuple &t, std::vector< Tuple > &new_tets)
Split a tet in 4 tets.
Definition TetMeshTetSplittingConn.cpp:6
Tuple tuple_from_edge(size_t tid, int local_eid) const
get a Tuple from global tetra index and local edge index (from 0-5).
Definition TetMesh.cpp:353
size_t vertex_size() const
get the number of unremoved verticies
Definition TetMesh.h:367
Tuple switch_vertex(const Tuple &t) const
wrapper function from Tuple::switch_vertex
Definition TetMesh.h:921
virtual bool swap_face_before(const Tuple &t)
User specified preparations and desideratas for an 2-3 face swap befroe changing the geometry.
Definition TetMesh.h:805
bool try_set_edge_mutex_two_ring(const Tuple &e, int threadid=0)
try lock the two-ring neighboring triangles' incident vertices for the two ends of an edge
Definition TetMesh.cpp:1023
bool swap_edge(const Tuple &t, std::vector< Tuple > &new_tets)
3-2 edge swap
Definition TetMeshSwapMeshConnectivity.cpp:120
Tuple switch_edge(const Tuple &t) const
wrapper function from Tuple::switch_edge
Definition TetMesh.h:930
std::vector< Tuple > get_edges() const
Definition TetMesh.cpp:172
std::vector< size_t > get_one_ring_tids_for_vertex(const Tuple &t) const
Get the one ring tids for vertex.
Definition TetMesh.cpp:690
virtual bool split_tet_after(const Tuple &t)
Compute the attributes for the added simplices.
Definition TetMesh.h:860
void for_each_edge(const std::function< void(const TetMesh::Tuple &)> &)
perform the given function for each edge
Definition TetMesh.cpp:1294
bool collapse_edge_conn(const Tuple &loc0, std::vector< Tuple > &new_edges, size_t &v1_id, Tuple &new_loc, std::map< size_t, wmtk::TetMesh::VertexConnectivity > &rollback_vert_conn, std::vector< size_t > &n1_t_ids_copy, std::vector< size_t > &new_tet_id, std::vector< TetrahedronConnectivity > &old_tets)
Definition TetMeshEdgeCollapsingConn.cpp:449
void check_tuple_validity(const Tuple &t) const
Definition TetMesh.h:1062
void collapse_edge_rollback(size_t &v1_id, std::map< size_t, wmtk::TetMesh::VertexConnectivity > &rollback_vert_conn, std::vector< size_t > &n1_t_ids, std::vector< size_t > &new_tet_id, std::vector< TetrahedronConnectivity > &old_tets)
Definition TetMeshEdgeCollapsingConn.cpp:438
bool try_set_vertex_mutex_two_ring(const Tuple &v, int threadid)
try lock the two-ring neighboring traingles' incident vertices
Definition TetMesh.cpp:952
virtual bool collapse_edge(const Tuple &t, std::vector< Tuple > &new_tets)
Definition TetMeshEdgeCollapsingConn.cpp:263
bool try_set_face_mutex_two_ring(const Tuple &f, int threadid=0)
try lock the two-ring neighboring triangles' incident vertices for the 3 vertices of a face
Definition TetMesh.cpp:1069
Tuple tuple_from_face(size_t tid, int local_fid) const
get a Tuple from global tetra index and local face index (from 0-3).
Definition TetMesh.cpp:363
virtual bool split_edge_after(const Tuple &t)
This function computes the attributes for the added simplices. User specified modifications and desid...
Definition TetMesh.h:700
static constexpr std::array< std::array< int, 2 >, 6 > m_local_edges
local edges within a tet
Definition TetMesh.h:30
std::map< size_t, VertexConnectivity > operation_update_connectivity_impl(std::vector< size_t > &affected_tid, const std::vector< std::array< size_t, 4 > > &new_tet_conn)
Definition TetMeshSwapMeshConnectivity.cpp:43
std::array< Tuple, 3 > get_face_vertices(const Tuple &t) const
Get the 3 vertices of a face represented by Tuple.
Definition TetMesh.cpp:659
virtual bool swap_edge_56_after(const Tuple &t)
User specified modifications and desideratas for after a 5-6 edge swap.
Definition TetMesh.h:782
virtual bool collapse_edge_before(const Tuple &t)
User specified preparations and desideratas for an edge collapse before changing the connectivity.
Definition TetMesh.h:711
std::vector< Tuple > get_vertices() const
Definition TetMesh.cpp:323
size_t tet_capacity() const
get the current largest global tid
Definition TetMesh.h:361
std::vector< Tuple > get_one_ring_tets_for_vertex(const Tuple &t) const
Get the one ring tets for a vertex.
Definition TetMesh.cpp:701
void for_each_tetra(const std::function< void(const TetMesh::Tuple &)> &)
perform the given function for each tet
Definition TetMesh.cpp:1327
bool swap_edge_44(const Tuple &t, std::vector< Tuple > &new_tets)
Definition TetMeshSwapMeshConnectivity.cpp:472
virtual double swap_edge_56_energy(const std::vector< std::array< size_t, 4 > > &tets, const int op_case)
User specified energy to decide which of the 5 possible orientations should be chosen.
Definition TetMesh.h:770
bool swap_face(const Tuple &t, std::vector< Tuple > &new_tets)
2-3 face swap
Definition TetMeshSwapMeshConnectivity.cpp:231
void remove_tets_by_ids(const std::vector< size_t > &tids)
remove the tetrahedrons in the mesh that have given tet ids
Definition TetMesh.h:1075
Tuple tuple_from_vids(size_t vid0, size_t vid1, size_t vid2, size_t vid3) const
Get a Tuple from global vertex IDs.
Definition TetMesh.cpp:591
std::vector< std::array< size_t, 3 > > vertex_adjacent_boundary_faces(const Tuple &t) const
Definition TetMesh.cpp:915
virtual bool swap_face_after(const Tuple &t)
User specified modifications and desideratas for after a 2-3 face swap.
Definition TetMesh.h:812
Definition RawSimplex.hpp:57
Definition RawSimplex.hpp:71