]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Unify 2D and 3D implementations
authorMarco Feder <marco.feder@sissa.it>
Wed, 5 Jul 2023 22:50:40 +0000 (00:50 +0200)
committerMarco Feder <marco.feder@sissa.it>
Fri, 14 Jul 2023 07:58:27 +0000 (09:58 +0200)
source/grid/grid_tools.cc

index 43185a32f0a76cbb977f63f938e145427afdaac4..c2b37a345e252862682f4f1f0b1691c570cb0867 100644 (file)
@@ -5941,7 +5941,7 @@ namespace GridTools
         }
 
 #else
-
+      (void)tolerance;
       auto fill_ranks_and_indices =
         [&ranks_and_indices](
           const std::vector<int> &                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<BoundingBox<2>> 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<T, Point<spacedim>>::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<T, BoundingBox<spacedim>>::value)
         {
-          ArborXWrappers::DistributedTree distributed_tree(comm,
-                                                           global_bboxes[idx]);
+          ArborXWrappers::BoundingBoxIntersectPredicate bb_intersect(entities);
 
-          if constexpr (std::is_same<T, Point<3>>::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<T, BoundingBox<3>>::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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.