]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify parallel::TriangulationBase::update_number_cache 9962/head
authorPeter Munch <peterrmuench@gmail.com>
Sun, 26 Apr 2020 13:48:45 +0000 (15:48 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Sun, 26 Apr 2020 13:48:45 +0000 (15:48 +0200)
include/deal.II/distributed/fully_distributed_tria.h
include/deal.II/distributed/shared_tria.h
include/deal.II/distributed/tria.h
include/deal.II/distributed/tria_base.h
source/distributed/fully_distributed_tria.cc
source/distributed/shared_tria.cc
source/distributed/tria.cc
source/distributed/tria_base.cc

index 8e1678c4cf1a1d3bb7612fdb9085e59a982d5657..6d98768c2cca9f7512cd12a95bdae51e22592774 100644 (file)
@@ -242,13 +242,6 @@ namespace parallel
         const unsigned int coarse_cell_index) const override;
 
     private:
-      /**
-       * Override the function to update the number cache so we can fill data
-       * like @p level_ghost_owners.
-       */
-      virtual void
-      update_number_cache() override;
-
       /**
        * store the Settings.
        */
index cde151c46deb69b40380ead617a0aad4c7316cf8..f4604e548a93f84945916f8cbb3ac32ee18a549e 100644 (file)
@@ -342,13 +342,6 @@ namespace parallel
       with_artificial_cells() const;
 
     private:
-      /**
-       * Override the function to update the number cache so we can fill data
-       * like @p level_ghost_owners.
-       */
-      virtual void
-      update_number_cache() override;
-
       /**
        * Settings
        */
index d6d219527da4232c0af4f79527409b899feb7e75..bb133907d1e90490e59f5a68008895362c9a1279 100644 (file)
@@ -861,13 +861,6 @@ namespace parallel
 
 
     private:
-      /**
-       * Override the function to update the number cache so we can fill data
-       * like @p level_ghost_owners.
-       */
-      virtual void
-      update_number_cache() override;
-
       /**
        * store the Settings.
        */
index a4276bfbb677c32831db966cad5d72cce4646753..818c23be10e644c5d98407f1b4f6a63e1ed5b5df 100644 (file)
@@ -301,12 +301,6 @@ namespace parallel
      */
     virtual void
     update_number_cache();
-
-    /**
-     * Store MPI ranks of level ghost owners of this processor on all levels.
-     */
-    void
-    fill_level_ghost_owners();
   };
 
   /**
index 7fec8ccd2f2c42701de678ee194493f904357178..bded33a0e2718e46e500b2e152ef79ba7efce301 100644 (file)
@@ -173,7 +173,7 @@ namespace parallel
             }
         }
 
-      update_number_cache();
+      this->update_number_cache();
     }
 
 
@@ -265,19 +265,6 @@ namespace parallel
 
 
 
-    template <int dim, int spacedim>
-    void
-    Triangulation<dim, spacedim>::update_number_cache()
-    {
-      parallel::Triangulation<dim, spacedim>::update_number_cache();
-
-      if (settings &
-          TriangulationDescription::Settings::construct_multigrid_hierarchy)
-        parallel::Triangulation<dim, spacedim>::fill_level_ghost_owners();
-    }
-
-
-
     template <int dim, int spacedim>
     void
     Triangulation<dim, spacedim>::execute_coarsening_and_refinement()
index a21102ad3771bbc7f23f3447269e6902ed09e48b..e2f55d35defa7f201d645ea042c3f0bc3e952f8e 100644 (file)
@@ -419,18 +419,6 @@ namespace parallel
       partition();
       this->update_number_cache();
     }
-
-
-
-    template <int dim, int spacedim>
-    void
-    Triangulation<dim, spacedim>::update_number_cache()
-    {
-      parallel::TriangulationBase<dim, spacedim>::update_number_cache();
-
-      if (settings & construct_multigrid_hierarchy)
-        parallel::TriangulationBase<dim, spacedim>::fill_level_ghost_owners();
-    }
   } // namespace shared
 } // namespace parallel
 
index 039bcf194346bb10fd0bf37992f985ad6cbbf6ab..b7a4d53140d18553233f850b7de6baa6bd37bbb4 100644 (file)
@@ -2914,18 +2914,6 @@ namespace parallel
 
 
 
-    template <int dim, int spacedim>
-    void
-    Triangulation<dim, spacedim>::update_number_cache()
-    {
-      parallel::TriangulationBase<dim, spacedim>::update_number_cache();
-
-      if (settings & construct_multigrid_hierarchy)
-        parallel::TriangulationBase<dim, spacedim>::fill_level_ghost_owners();
-    }
-
-
-
     template <int dim, int spacedim>
     typename dealii::internal::p4est::types<dim>::tree *
     Triangulation<dim, spacedim>::init_tree(
index e12ddedbf91932a0f046666e4eb6e4a3f22ce3eb..7282d170925da9b87e74322ba4b019a943763626 100644 (file)
@@ -215,92 +215,90 @@ namespace parallel
 
     number_cache.n_global_levels =
       Utilities::MPI::max(this->n_levels(), this->mpi_communicator);
-  }
-
 
-
-  template <int dim, int spacedim>
-  void
-  TriangulationBase<dim, spacedim>::fill_level_ghost_owners()
-  {
-    number_cache.level_ghost_owners.clear();
-
-    // if there is nothing to do, then do nothing
-    if (this->n_levels() == 0)
-      return;
-
-    // find level ghost owners
-    for (typename Triangulation<dim, spacedim>::cell_iterator cell =
-           this->begin();
-         cell != this->end();
-         ++cell)
-      if (cell->level_subdomain_id() != numbers::artificial_subdomain_id &&
-          cell->level_subdomain_id() != this->locally_owned_subdomain())
-        this->number_cache.level_ghost_owners.insert(
-          cell->level_subdomain_id());
+    // Store MPI ranks of level ghost owners of this processor on all levels.
+    if (this->is_multilevel_hierarchy_constructed() == true)
+      {
+        number_cache.level_ghost_owners.clear();
+
+        // if there is nothing to do, then do nothing
+        if (this->n_levels() == 0)
+          return;
+
+        // find level ghost owners
+        for (typename Triangulation<dim, spacedim>::cell_iterator cell =
+               this->begin();
+             cell != this->end();
+             ++cell)
+          if (cell->level_subdomain_id() != numbers::artificial_subdomain_id &&
+              cell->level_subdomain_id() != this->locally_owned_subdomain())
+            this->number_cache.level_ghost_owners.insert(
+              cell->level_subdomain_id());
 
 #  ifdef DEBUG
-    // Check that level_ghost_owners is symmetric by sending a message to
-    // everyone
-    {
-      int ierr = MPI_Barrier(this->mpi_communicator);
-      AssertThrowMPI(ierr);
-
-      const int mpi_tag = Utilities::MPI::internal::Tags::
-        triangulation_base_fill_level_ghost_owners;
-
-      // important: preallocate to avoid (re)allocation:
-      std::vector<MPI_Request> requests(
-        this->number_cache.level_ghost_owners.size());
-      unsigned int dummy       = 0;
-      unsigned int req_counter = 0;
-
-      for (std::set<types::subdomain_id>::iterator it =
-             this->number_cache.level_ghost_owners.begin();
-           it != this->number_cache.level_ghost_owners.end();
-           ++it, ++req_counter)
-        {
-          ierr = MPI_Isend(&dummy,
-                           1,
-                           MPI_UNSIGNED,
-                           *it,
-                           mpi_tag,
-                           this->mpi_communicator,
-                           &requests[req_counter]);
-          AssertThrowMPI(ierr);
-        }
-
-      for (std::set<types::subdomain_id>::iterator it =
-             this->number_cache.level_ghost_owners.begin();
-           it != this->number_cache.level_ghost_owners.end();
-           ++it)
+        // Check that level_ghost_owners is symmetric by sending a message to
+        // everyone
         {
-          unsigned int dummy;
-          ierr = MPI_Recv(&dummy,
-                          1,
-                          MPI_UNSIGNED,
-                          *it,
-                          mpi_tag,
-                          this->mpi_communicator,
-                          MPI_STATUS_IGNORE);
+          int ierr = MPI_Barrier(this->mpi_communicator);
           AssertThrowMPI(ierr);
-        }
 
-      if (requests.size() > 0)
-        {
-          ierr =
-            MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE);
+          const int mpi_tag = Utilities::MPI::internal::Tags::
+            triangulation_base_fill_level_ghost_owners;
+
+          // important: preallocate to avoid (re)allocation:
+          std::vector<MPI_Request> requests(
+            this->number_cache.level_ghost_owners.size());
+          unsigned int dummy       = 0;
+          unsigned int req_counter = 0;
+
+          for (std::set<types::subdomain_id>::iterator it =
+                 this->number_cache.level_ghost_owners.begin();
+               it != this->number_cache.level_ghost_owners.end();
+               ++it, ++req_counter)
+            {
+              ierr = MPI_Isend(&dummy,
+                               1,
+                               MPI_UNSIGNED,
+                               *it,
+                               mpi_tag,
+                               this->mpi_communicator,
+                               &requests[req_counter]);
+              AssertThrowMPI(ierr);
+            }
+
+          for (std::set<types::subdomain_id>::iterator it =
+                 this->number_cache.level_ghost_owners.begin();
+               it != this->number_cache.level_ghost_owners.end();
+               ++it)
+            {
+              unsigned int dummy;
+              ierr = MPI_Recv(&dummy,
+                              1,
+                              MPI_UNSIGNED,
+                              *it,
+                              mpi_tag,
+                              this->mpi_communicator,
+                              MPI_STATUS_IGNORE);
+              AssertThrowMPI(ierr);
+            }
+
+          if (requests.size() > 0)
+            {
+              ierr = MPI_Waitall(requests.size(),
+                                 requests.data(),
+                                 MPI_STATUSES_IGNORE);
+              AssertThrowMPI(ierr);
+            }
+
+          ierr = MPI_Barrier(this->mpi_communicator);
           AssertThrowMPI(ierr);
         }
-
-      ierr = MPI_Barrier(this->mpi_communicator);
-      AssertThrowMPI(ierr);
-    }
 #  endif
 
-    Assert(this->number_cache.level_ghost_owners.size() <
-             Utilities::MPI::n_mpi_processes(this->mpi_communicator),
-           ExcInternalError());
+        Assert(this->number_cache.level_ghost_owners.size() <
+                 Utilities::MPI::n_mpi_processes(this->mpi_communicator),
+               ExcInternalError());
+      }
   }
 
 #else
@@ -312,13 +310,6 @@ namespace parallel
     Assert(false, ExcNotImplemented());
   }
 
-  template <int dim, int spacedim>
-  void
-  TriangulationBase<dim, spacedim>::fill_level_ghost_owners()
-  {
-    Assert(false, ExcNotImplemented());
-  }
-
 #endif
 
   template <int dim, int spacedim>

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.