]> https://gitweb.dealii.org/ - dealii.git/commitdiff
use level_ghost_owners
authorTimo Heister <timo.heister@gmail.com>
Sun, 4 Oct 2015 19:40:55 +0000 (15:40 -0400)
committerTimo Heister <timo.heister@gmail.com>
Sun, 4 Oct 2015 19:40:55 +0000 (15:40 -0400)
source/multigrid/mg_transfer_prebuilt.cc

index 3e05337ae759e7e3e418ee17a28073568fc9c982..e2d5a8dc962f9fd0a5c4659340b73074fd64cce5 100644 (file)
@@ -382,28 +382,15 @@ void MGTransferPrebuilt<VECTOR>::build_matrices (
 
   if (tria)
     {
-      // TODO: This is a gigantic hack. We don't have a list of all our ghost
-      // neighbors, so we communicate with every other process. Searching the
-      // owner for every single DoF becomes quite inefficient. Please fix
-      // this, Timo.
-
-      std::vector<unsigned int> neighbors;
+      // TODO: Searching the owner for every single DoF becomes quite
+      // inefficient. Please fix this, Timo.
+      std::set<unsigned int> neighbors = tria->level_ghost_owners();
       std::map<int, std::vector<dof_pair> > send_data;
 
-      {
-        // TODO: replace this with the minimum ghost neighbor list that should
-        // come from Triangulation
-        int n_proc = Utilities::MPI::n_mpi_processes(tria->get_communicator());
-        int myid = tria->locally_owned_subdomain();
-        for (unsigned int i=0; i<n_proc; ++i)
-          if (i!=myid)
-            neighbors.push_back(i);
-      }
-
       // * find owners of the level dofs and insert into send_data accordingly
       for (typename std::vector<dof_pair>::iterator dofpair=send_data_temp.begin(); dofpair != send_data_temp.end(); ++dofpair)
         {
-          for (std::vector<unsigned int>::iterator it = neighbors.begin(); it != neighbors.end(); ++it)
+          for (std::set<unsigned int>::iterator it = neighbors.begin(); it != neighbors.end(); ++it)
             {
               if (mg_dof.locally_owned_mg_dofs_per_processor(dofpair->level)[*it].is_element(dofpair->level_dof_index))
                 {
@@ -416,7 +403,7 @@ void MGTransferPrebuilt<VECTOR>::build_matrices (
       // * send
       std::vector<MPI_Request> requests;
       {
-        for (std::vector<unsigned int>::iterator it = neighbors.begin(); it != neighbors.end(); ++it)
+        for (std::set<unsigned int>::iterator it = neighbors.begin(); it != neighbors.end(); ++it)
           {
             requests.push_back(MPI_Request());
             unsigned int dest = *it;
@@ -431,7 +418,7 @@ void MGTransferPrebuilt<VECTOR>::build_matrices (
       // * receive
       {
         typename std::vector<dof_pair> receive;
-        for (std::vector<unsigned int>::iterator it = neighbors.begin(); it != neighbors.end(); ++it)
+        for (std::set<unsigned int>::iterator it = neighbors.begin(); it != neighbors.end(); ++it)
           {
             MPI_Status status;
             int len;

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.