| 460 | } |
| 461 | |
| 462 | size_t getNumComponents( const MeshPart& meshPart, FaceIncidence incidence, const UndirectedEdgeBitSet * isCompBd ) |
| 463 | { |
| 464 | MR_TIMER; |
| 465 | auto unionFindStruct = getUnionFindStructureFaces( meshPart, incidence, isCompBd ); |
| 466 | const FaceBitSet& region = meshPart.mesh.topology.getFaceIds( meshPart.region ); |
| 467 | |
| 468 | std::atomic<size_t> res{ 0 }; |
| 469 | tbb::parallel_for( tbb::blocked_range<FaceId>( 0_f, FaceId( unionFindStruct.size() ) ), |
| 470 | [&]( const tbb::blocked_range<FaceId> & range ) |
| 471 | { |
| 472 | size_t myRoots = 0; |
| 473 | for ( auto f = range.begin(); f < range.end(); ++f ) |
| 474 | { |
| 475 | if ( !region.test( f ) ) |
| 476 | continue; |
| 477 | if ( f == unionFindStruct.findUpdateRange( f, range.begin(), range.end() ) ) |
| 478 | ++myRoots; |
| 479 | } |
| 480 | res.fetch_add( myRoots, std::memory_order_relaxed ); |
| 481 | } ); |
| 482 | return res; |
| 483 | } |
| 484 | |
| 485 | std::pair<std::vector<FaceBitSet>, int> getAllComponents( const MeshPart& meshPart, int maxComponentCount, |
| 486 | FaceIncidence incidence /*= FaceIncidence::PerEdge*/, const UndirectedEdgeBitSet * isCompBd /*= {}*/ ) |