diff --git a/network_process/src/connect_by_topo/patch_connectivity.cpp b/network_process/src/connect_by_topo/patch_connectivity.cpp index bd2e75e..35a59fc 100644 --- a/network_process/src/connect_by_topo/patch_connectivity.cpp +++ b/network_process/src/connect_by_topo/patch_connectivity.cpp @@ -82,12 +82,12 @@ void compute_patches(const stl_vector_mp>& edges_of } } -void compute_chains(const flat_hash_map_mp& patch_edges, - const flat_hash_set_mp& patch_boundary_edges, - const stl_vector_mp& iso_faces, - stl_vector_mp>& chain_vertices, - stl_vector_mp& chain_edge_headers, - stl_vector_mp& chain_headers) +void compute_chains(const flat_hash_map_mp& patch_edges, + const flat_hash_set_mp& patch_boundary_edges, + const stl_vector_mp& iso_faces, + stl_vector_mp>& chain_vertices, + stl_vector_mp& chain_edge_headers, + stl_vector_mp& chain_headers) { flat_hash_map_mp> non_manifold_edges_of_vert{}; non_manifold_edges_of_vert.reserve(patch_boundary_edges.size() / 2); @@ -117,10 +117,7 @@ void compute_chains(const flat_hash_map_mp& patch_e flat_hash_set_mp unique_volume_indices{}; new_chain_edge_headers.subface_indices.reserve(new_chain_headers.face_indices.size()); for (const auto& face_index : new_chain_headers.face_indices) { - std::transform(iso_faces[face_index].headers.begin(), - iso_faces[face_index].headers.end(), - std::back_inserter(unique_volume_indices), - [](const face_header_t& header) { return header.volume_index; }); + for (const auto& [volume_index, _] : iso_faces[face_index].headers) unique_volume_indices.emplace(volume_index); new_chain_edge_headers.subface_indices.emplace_back(iso_faces[face_index].subface_index); } std::move(unique_volume_indices.begin(), diff --git a/network_process/src/post_topo/map_chains.cpp b/network_process/src/post_topo/map_chains.cpp index 6723e77..15c1b23 100644 --- a/network_process/src/post_topo/map_chains.cpp +++ b/network_process/src/post_topo/map_chains.cpp @@ -22,7 +22,8 @@ void map_chain_to_parameteric_plane(const baked_blobtree_t& stl_vector_mp unique_chain_indices{}; flat_hash_map_mp old_chain_index_to_unique_index{}; auto unique_end_iter = unique_chain_indices.begin(); - for (const auto& [subface_index, patch_indices] : patch_of_subface) { + for (const auto& [subface_index_, patch_indices] : patch_of_subface) { + const auto subface_index = subface_index_; const auto& subface = subfaces[subface_index].object_ptr.get(); auto mapping_func = subface.fetch_param_mapping_evaluator(); auto& parameteric_plane = parameteric_planes[subface_index]; @@ -62,7 +63,11 @@ void map_chain_to_parameteric_plane(const baked_blobtree_t& chain_vertex_flags_[0] = chain_end_vertex_signular_flag[2 * chain_index]; chain_vertex_flags_[chain.size() - 1] = chain_end_vertex_signular_flag[2 * chain_index + 1]; - chain_other_subface_indices.emplace_back(chain_edge_headers[chain_index].subface_indices); + const auto& subface_indices = chain_edge_headers[chain_index].subface_indices; + const auto other_subface_index = *std::find_if_not(subface_indices.begin(), + subface_indices.end(), + [&](uint32_t index) { return index == subface_index; }); + chain_other_subface_indices.emplace_back(other_subface_index); } for (const auto& patch_index : patch_indices) {