From: Marco Feder Date: Wed, 5 Jul 2023 22:50:40 +0000 (+0200) Subject: Unify 2D and 3D implementations X-Git-Tag: relicensing~677^2~6 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=150bba5febb6a1dae8f9eaa7ce4da64bb88e3376;p=dealii.git Unify 2D and 3D implementations --- diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index 43185a32f0..c2b37a345e 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -5941,7 +5941,7 @@ namespace GridTools } #else - + (void)tolerance; auto fill_ranks_and_indices = [&ranks_and_indices]( const std::vector & offsets, @@ -5954,46 +5954,25 @@ namespace GridTools unsigned int idx = (global_bboxes.size() == 1) ? 0 : Utilities::MPI::this_mpi_process(comm); - // size of global_bboxes>1 - if constexpr (spacedim == 2) - { - // Create query bounding boxes out of entities - std::vector> query_bounding_boxes; - for (const auto &entity : entities) - query_bounding_boxes.push_back( - BoundingBox<2>(entity).create_extended(tolerance)); - ArborXWrappers::BoundingBoxIntersectPredicate bb_intersect( - query_bounding_boxes); - ArborXWrappers::DistributedTree distributed_tree(comm, - global_bboxes[idx]); + ArborXWrappers::DistributedTree distributed_tree(comm, + global_bboxes[idx]); + + if constexpr (std::is_same>::value) + { + ArborXWrappers::PointIntersectPredicate bb_intersect(entities); const auto &[indices_ranks, offsets] = distributed_tree.query(bb_intersect); fill_ranks_and_indices(offsets, indices_ranks); } - else if constexpr (spacedim == 3) + else if constexpr (std::is_same>::value) { - ArborXWrappers::DistributedTree distributed_tree(comm, - global_bboxes[idx]); + ArborXWrappers::BoundingBoxIntersectPredicate bb_intersect(entities); - if constexpr (std::is_same>::value) - { - ArborXWrappers::PointIntersectPredicate bb_intersect(entities); - - const auto &[indices_ranks, offsets] = - distributed_tree.query(bb_intersect); - fill_ranks_and_indices(offsets, indices_ranks); - } - else if constexpr (std::is_same>::value) - { - ArborXWrappers::BoundingBoxIntersectPredicate bb_intersect( - entities); - - const auto &[indices_ranks, offsets] = - distributed_tree.query(bb_intersect); - fill_ranks_and_indices(offsets, indices_ranks); - } + const auto &[indices_ranks, offsets] = + distributed_tree.query(bb_intersect); + fill_ranks_and_indices(offsets, indices_ranks); } #endif