]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Do not derive the ParallelShared policy from the Sequential one. 4547/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 26 Jun 2017 07:34:02 +0000 (01:34 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 26 Jun 2017 13:28:35 +0000 (07:28 -0600)
The derivation was slightly contrived, but is not in fact useful any more since
the code has been refactored in ways that allow breaking the derivation and
just calling in ParallelShared what is also called in Sequential. In fact, the
code may have even become a bit shorter that way.

include/deal.II/dofs/dof_handler_policy.h
source/dofs/dof_handler_policy.cc

index 8fcefd75ad6e27990733a3332ac8cc742610c49f..a4d185a29be8a4a50abdbd13b6701113d32d78da 100644 (file)
@@ -135,7 +135,7 @@ namespace internal
        * parallel::shared::Triangulation object.
        */
       template <int dim, int spacedim>
-      class ParallelShared : public Sequential<dim,spacedim>
+      class ParallelShared : public PolicyBase<dim,spacedim>
       {
       public:
         /**
@@ -176,6 +176,12 @@ namespace internal
         virtual
         NumberCache
         renumber_dofs (const std::vector<types::global_dof_index>  &new_numbers) const;
+
+      private:
+        /**
+         * The DoFHandler object on which this policy object works.
+         */
+        SmartPointer<dealii::DoFHandler<dim,spacedim> > dof_handler;
       };
 
 
index 3159e3ab5bcbe0704c117144053e26b500355c5f..5b72caaf54c63cd7ee28ff466e93f034a1dd6849 100644 (file)
@@ -1052,7 +1052,7 @@ namespace internal
       ParallelShared<dim,spacedim>::
       ParallelShared (dealii::DoFHandler<dim,spacedim> &dof_handler)
         :
-        Sequential<dim,spacedim> (dof_handler)
+        dof_handler (&dof_handler)
       {}
 
 
@@ -1166,8 +1166,9 @@ namespace internal
 
         // first let the sequential algorithm do its magic. it is going to
         // enumerate DoFs on all cells, regardless of owner
-        NumberCache sequential_number_cache
-          = this->Sequential<dim,spacedim>::distribute_dofs ();
+        const types::global_dof_index n_dofs =
+          Implementation::distribute_dofs (numbers::invalid_subdomain_id,
+                                           *this->dof_handler);
 
         // then re-enumerate them based on their subdomain association.
         // for this, we first have to identify for each current DoF
@@ -1178,7 +1179,6 @@ namespace internal
         // function has to deal with other kinds of triangulations as
         // well, whereas we here know what kind of triangulation
         // we have and can simplify the code accordingly
-        const unsigned int n_dofs = sequential_number_cache.n_global_dofs;
         std::vector<types::global_dof_index> new_dof_indices (n_dofs,
                                                               numbers::invalid_dof_index);
         {
@@ -1214,10 +1214,8 @@ namespace internal
         // version of the function because we do things on all
         // cells and all cells have their subdomain ids and DoFs
         // correctly set
-        //
-        // the return value is not of interest to us here
-        this->Sequential<dim, spacedim>::renumber_dofs (new_dof_indices);
-
+        Implementation::renumber_dofs (new_dof_indices, IndexSet(0),
+                                       *this->dof_handler, true);
 
         // update the number cache. for this, we first have to find the subdomain
         // association for each DoF again following renumbering, from which we
@@ -1292,13 +1290,12 @@ namespace internal
       ParallelShared<dim,spacedim>::
       distribute_mg_dofs () const
       {
-        // first, call the sequential function to distribute dofs
-        const std::vector<NumberCache> number_caches
-          = this->Sequential<dim,spacedim>::distribute_mg_dofs ();
-        // now we need to update the number cache. This part is not yet implemented.
+        // this is not currently implemented; the algorithm should work
+        // as above, though: first call the sequential numbering
+        // algorithm, then re-enumerate subdomain-wise
         Assert(false,ExcNotImplemented());
 
-        return number_caches;
+        return std::vector<NumberCache>();
       }
 
 
@@ -1423,7 +1420,8 @@ namespace internal
         // let the sequential algorithm do its magic; ignore the
         // return type, but reconstruct the number cache based on
         // which DoFs each process owns
-        this->Sequential<dim, spacedim>::renumber_dofs (global_gathered_numbers);
+        Implementation::renumber_dofs (global_gathered_numbers, IndexSet(0),
+                                       *this->dof_handler, true);
 
         const NumberCache number_cache (DoFTools::locally_owned_dofs_per_subdomain (*this->dof_handler),
                                         this->dof_handler->get_triangulation().locally_owned_subdomain ());

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.