|
|
|
@ -1,4 +1,3 @@ |
|
|
|
#include <functional> |
|
|
|
#include <numeric> |
|
|
|
#include <connect_by_topo.hpp> |
|
|
|
|
|
|
|
@ -254,18 +253,23 @@ void pair_patches_in_tets(const stl_vector_mp<uint32_t> &containi |
|
|
|
uint32_t vId1 = containing_simplex[0]; |
|
|
|
uint32_t vId2 = containing_simplex[1]; |
|
|
|
flat_hash_map_mp<pod_key_t<3>, face_header_t> tet_plane_of_tri{}; |
|
|
|
uint32_t vId; |
|
|
|
pod_key_t<3> tri; |
|
|
|
static const std::array triangle_indices = { |
|
|
|
std::array{1u, 2u, 3u}, // 0
|
|
|
|
std::array{0u, 2u, 3u}, // 1
|
|
|
|
std::array{0u, 1u, 3u}, // 2
|
|
|
|
std::array{0u, 1u, 2u} // 3
|
|
|
|
}; |
|
|
|
for (const auto tId : containing_tetIds) { |
|
|
|
const auto &tet_vertices = tetrahedrons[tId]; |
|
|
|
for (uint32_t i = 0; i < 4; ++i) { |
|
|
|
vId = tetrahedrons[tId][i]; |
|
|
|
uint32_t vId = tet_vertices[i]; |
|
|
|
if (vId != vId1 && vId != vId2) { |
|
|
|
tri = {tetrahedrons[tId][(i + 1) % 4], tetrahedrons[tId][(i + 2) % 4], tetrahedrons[tId][(i + 3) % 4]}; |
|
|
|
std::sort(tri.begin(), tri.end()); |
|
|
|
auto iter_inserted = tet_plane_of_tri.try_emplace(tri, face_header_t{tId, i}); |
|
|
|
if (!iter_inserted.second) { |
|
|
|
identical_tet_planes[{tId, i}] = iter_inserted.first->second; |
|
|
|
identical_tet_planes[iter_inserted.first->second] = {tId, i}; |
|
|
|
face_header_t triangle_header{tId, i}; |
|
|
|
auto [iter, is_new] = tet_plane_of_tri.try_emplace(triangle_indices[i], triangle_header); |
|
|
|
const auto &other_triangle_header = iter->second; |
|
|
|
if (!is_new) { |
|
|
|
identical_tet_planes[triangle_header] = other_triangle_header; |
|
|
|
identical_tet_planes[other_triangle_header] = triangle_header; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|