MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / getNumComponents

Function getNumComponents

source/MRMesh/MRMeshComponents.cpp:462–483  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

460}
461
462size_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
485std::pair<std::vector<FaceBitSet>, int> getAllComponents( const MeshPart& meshPart, int maxComponentCount,
486 FaceIncidence incidence /*= FaceIncidence::PerEdge*/, const UndirectedEdgeBitSet * isCompBd /*= {}*/ )

Callers 6

numComponentsMethod · 0.70
numComponentsMethod · 0.70
testBuildWithDupsFunction · 0.50
TESTFunction · 0.50
buildFunction · 0.50
EMSCRIPTEN_BINDINGSFunction · 0.50

Calls 6

findUpdateRangeMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
testMethod · 0.45

Tested by 2

testBuildWithDupsFunction · 0.40
TESTFunction · 0.40