Skip to content

Commit

Permalink
Merge pull request #2326 from feelpp/2325-fix-bvh-when-mpi-process-ha…
Browse files Browse the repository at this point in the history
…s-no-triangles

fix bvh when mpi process has no triangles #2325
  • Loading branch information
prudhomm authored Feb 11, 2025
2 parents 808bca3 + 4d4ebe7 commit 640e1d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions feelpp/feel/feelmesh/bvh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,10 @@ class BVH_ThirdParty : public BVH<MeshEntityType>
case BVHEnum::Quality::Medium: config.quality = bvh::v2::DefaultBuilder<node_type>::Quality::Medium; break;
case BVHEnum::Quality::Low: config.quality = bvh::v2::DefaultBuilder<node_type>::Quality::Low; break;
}
M_bvh = std::make_unique<backend_bvh_type>( bvh::v2::DefaultBuilder<node_type>::build(/*thread_pool,*/ bboxes, centers, config) );

if ( !bboxes.empty() )
M_bvh = std::make_unique<backend_bvh_type>( bvh::v2::DefaultBuilder<node_type>::build(/*thread_pool,*/ bboxes, centers, config) );
else
M_bvh.reset();

// Permuting the primitive data allows to remove indirections during traversal, which makes it faster.
static constexpr bool should_permute = true;
Expand Down Expand Up @@ -473,6 +475,8 @@ class BVH_ThirdParty : public BVH<MeshEntityType>
template <bool UseRobustTraversal>
std::vector<rayintersection_result_type> intersectImpl( bvh::v2::Ray<value_type,nRealDim> & rayBackend )
{
if ( !M_bvh )
return {};
static constexpr size_t stack_size = 64;
static constexpr bool should_permute = true;
static constexpr bool isAnyHit = false;
Expand Down
2 changes: 1 addition & 1 deletion feelpp/feel/feelmesh/meshfragmentation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class MeshFragmentation
auto addFragment( int fragmentId, std::string const& fragmentName, RT && r )
{
CHECK( M_strategy == Strategy::Custom ) << "add fragment only valid with custom strategy";
return M_customParts.emplace( std::make_tuple( fragmentId, fragmentName, std::forward<RT>( r ) ) );
return M_customParts.emplace( fragmentId, std::make_tuple( fragmentName, std::forward<RT>( r ) ) );
}

private:
Expand Down

0 comments on commit 640e1d3

Please sign in to comment.