| 689 | } |
| 690 | |
| 691 | std::vector<EdgeBitSet> getAllComponentsEdges( const Mesh& mesh, const EdgeBitSet & edges ) |
| 692 | { |
| 693 | MR_TIMER; |
| 694 | auto unionFindStruct = getUnionFindStructureVerts( mesh, edges ); |
| 695 | |
| 696 | const auto& allRoots = unionFindStruct.roots(); |
| 697 | constexpr int InvalidRoot = -1; |
| 698 | std::vector<int> uniqueRootsMap( allRoots.size(), InvalidRoot ); |
| 699 | int k = 0; |
| 700 | EdgeId eMax; |
| 701 | for ( auto e : edges ) |
| 702 | { |
| 703 | if ( eMax < e ) |
| 704 | eMax = e; |
| 705 | int curRoot = allRoots[ mesh.topology.org( e ) ]; |
| 706 | auto& uniqIndex = uniqueRootsMap[curRoot]; |
| 707 | if ( uniqIndex == InvalidRoot ) |
| 708 | { |
| 709 | uniqIndex = k; |
| 710 | ++k; |
| 711 | } |
| 712 | } |
| 713 | std::vector<EdgeBitSet> res( k, EdgeBitSet( eMax + 1 ) ); |
| 714 | for ( auto e : edges ) |
| 715 | { |
| 716 | int curRoot = allRoots[ mesh.topology.org( e ) ]; |
| 717 | res[uniqueRootsMap[curRoot]].set( e ); |
| 718 | } |
| 719 | return res; |
| 720 | } |
| 721 | |
| 722 | std::vector<UndirectedEdgeBitSet> getAllComponentsUndirectedEdges( const Mesh& mesh, const UndirectedEdgeBitSet& edges ) |
| 723 | { |