]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Merge pull request #7569 from GivAlz/AddTestGlobalTree
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Wed, 9 Jan 2019 18:18:47 +0000 (19:18 +0100)
committerGitHub <noreply@github.com>
Wed, 9 Jan 2019 18:18:47 +0000 (19:18 +0100)
Add test and support for non-mpi to GridTools::build_global_tree

1  2 
source/grid/grid_tools.cc

index 57717e4e48f10b36a3a6dd09863e17804070a85f,caa15ded21db24226353d16e62e0be617451f367..e48689f582321069caacbef20ec52ff2fd221999
@@@ -5090,15 -5088,18 +5090,17 @@@ namespace GridTool
      MPI_Comm                                  mpi_communicator)
    {
  #ifndef DEAL_II_WITH_MPI
-     (void)local_description;
      (void)mpi_communicator;
-     Assert(false,
-            ExcMessage(
-              "GridTools::build_global_description_tree() requires MPI."));
-     return RTree<std::pair<BoundingBox<spacedim>, unsigned int>>{};
+     // Building a tree with the only boxes available without MPI
+     std::vector<std::pair<BoundingBox<spacedim>, unsigned int>> boxes_index(
+       local_description.size());
+     // Adding to each box the rank of the process owning it
+     for (unsigned int i = 0; i < local_description.size(); ++i)
+       boxes_index[i] = std::make_pair(local_description[i], 0u);
+     return pack_rtree(boxes_index);
  #else
      // Exchanging local bounding boxes
 -    std::vector<std::vector<BoundingBox<spacedim>>> global_bboxes;
 -    global_bboxes =
 +    const std::vector<std::vector<BoundingBox<spacedim>>> global_bboxes =
        Utilities::MPI::all_gather(mpi_communicator, local_description);
  
      // Preparing to flatten the vector

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.