]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Provide the ParallelDistributed policy with a DoFHandler template argument.
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 17 Jul 2017 23:45:51 +0000 (17:45 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 17 Jul 2017 23:57:43 +0000 (17:57 -0600)
include/deal.II/distributed/tria.h
include/deal.II/dofs/dof_handler_policy.h
source/dofs/dof_handler.cc
source/dofs/dof_handler_policy.cc
source/dofs/dof_handler_policy.inst.in
source/hp/dof_handler.cc

index de8a9ec73633da5b5eb73967626e37f9738479bb..3586348ae1c22571b38bb4a8a0d5ae265883f8dc 100644 (file)
@@ -58,7 +58,7 @@ namespace internal
   {
     namespace Policy
     {
-      template <int, int> class ParallelDistributed;
+      template <typename> class ParallelDistributed;
     }
   }
 }
@@ -890,7 +890,7 @@ namespace parallel
       std::vector<bool>
       mark_locally_active_vertices_on_level(const int level) const;
 
-      template <int, int> friend class dealii::internal::DoFHandler::Policy::ParallelDistributed;
+      template <typename> friend class dealii::internal::DoFHandler::Policy::ParallelDistributed;
 
       template <int,int,class> friend class dealii::FETools::internal::ExtrapolateImplementation;
     };
index 48a465b2bc833e647533e82dd58bcbf0d97cc287..03cf46e0b3c9cc5cfc5682ac3612313fff1d3866 100644 (file)
@@ -216,8 +216,8 @@ namespace internal
        * This class implements the policy for operations when we use a
        * parallel::distributed::Triangulation object.
        */
-      template <int dim, int spacedim>
-      class ParallelDistributed : public PolicyBase<dim,spacedim>
+      template <typename DoFHandlerType>
+      class ParallelDistributed : public PolicyBase<DoFHandlerType::dimension,DoFHandlerType::space_dimension>
       {
       public:
         /**
@@ -225,7 +225,7 @@ namespace internal
          * @param dof_handler The DoFHandler object upon which this
          *   policy class is supposed to work.
          */
-        ParallelDistributed (dealii::DoFHandler<dim,spacedim> &dof_handler);
+        ParallelDistributed (DoFHandlerType &dof_handler);
 
         // documentation is inherited
         virtual
@@ -252,7 +252,7 @@ namespace internal
         /**
          * The DoFHandler object on which this policy object works.
          */
-        SmartPointer<dealii::DoFHandler<dim,spacedim> > dof_handler;
+        SmartPointer<DoFHandlerType> dof_handler;
       };
     }
   }
index 62c27aa8978a21daf875c97dc157146341a0fc71..a43401817fe80fc73cda58ac48cd4b41350b612f 100644 (file)
@@ -69,7 +69,8 @@ namespace internal
     if (dynamic_cast<const typename dealii::internal::DoFHandler::Policy::Sequential<dealii::DoFHandler<dim,spacedim> >*>(&policy)
         || dynamic_cast<const typename dealii::internal::DoFHandler::Policy::Sequential<dealii::hp::DoFHandler<dim,spacedim> >*>(&policy))
       policy_name = "Policy::Sequential<";
-    else if (dynamic_cast<const typename dealii::internal::DoFHandler::Policy::ParallelDistributed<dim,spacedim>*>(&policy))
+    else if (dynamic_cast<const typename dealii::internal::DoFHandler::Policy::ParallelDistributed<dealii::DoFHandler<dim,spacedim> >*>(&policy)
+             || dynamic_cast<const typename dealii::internal::DoFHandler::Policy::ParallelDistributed<dealii::hp::DoFHandler<dim,spacedim> >*>(&policy))
       policy_name = "Policy::ParallelDistributed<";
     else if (dynamic_cast<const typename dealii::internal::DoFHandler::Policy::ParallelShared<dealii::DoFHandler<dim,spacedim> >*>(&policy))
       policy_name = "Policy::ParallelShared<";
@@ -664,7 +665,7 @@ DoFHandler<dim,spacedim>::DoFHandler (const Triangulation<dim,spacedim> &tria)
            == nullptr)
     policy.reset (new internal::DoFHandler::Policy::Sequential<DoFHandler<dim,spacedim> >(*this));
   else
-    policy.reset (new internal::DoFHandler::Policy::ParallelDistributed<dim,spacedim>(*this));
+    policy.reset (new internal::DoFHandler::Policy::ParallelDistributed<DoFHandler<dim,spacedim> >(*this));
 }
 
 
@@ -703,7 +704,7 @@ initialize(const Triangulation<dim,spacedim> &t,
   if (dynamic_cast<const parallel::shared::Triangulation< dim, spacedim>*> (&t) != nullptr)
     policy.reset (new internal::DoFHandler::Policy::ParallelShared<DoFHandler<dim,spacedim> >(*this));
   else if (dynamic_cast<const parallel::distributed::Triangulation< dim, spacedim >*> (&t) != nullptr)
-    policy.reset (new internal::DoFHandler::Policy::ParallelDistributed<dim,spacedim>(*this));
+    policy.reset (new internal::DoFHandler::Policy::ParallelDistributed<DoFHandler<dim,spacedim> >(*this));
   else
     policy.reset (new internal::DoFHandler::Policy::Sequential<DoFHandler<dim,spacedim> >(*this));
 
index 38ce8a72a32f7b8b5dd66c450f72261f8541ad94..d67f56b61448149ff45a214215c526855ea1c99e 100644 (file)
@@ -3466,9 +3466,9 @@ namespace internal
 
 
 
-      template <int dim, int spacedim>
-      ParallelDistributed<dim,spacedim>::
-      ParallelDistributed (dealii::DoFHandler<dim,spacedim> &dof_handler)
+      template <typename DoFHandlerType>
+      ParallelDistributed<DoFHandlerType>::
+      ParallelDistributed (DoFHandlerType &dof_handler)
         :
         dof_handler (&dof_handler)
       {}
@@ -3478,9 +3478,9 @@ namespace internal
 
 
 
-      template <int dim, int spacedim>
+      template <typename DoFHandlerType>
       NumberCache
-      ParallelDistributed<dim, spacedim>::
+      ParallelDistributed<DoFHandlerType>::
       distribute_dofs () const
       {
         NumberCache number_cache;
@@ -3488,6 +3488,8 @@ namespace internal
 #ifndef DEAL_II_WITH_P4EST
         Assert (false, ExcNotImplemented());
 #else
+        const unsigned int dim      = DoFHandlerType::dimension;
+        const unsigned int spacedim = DoFHandlerType::space_dimension;
 
         parallel::distributed::Triangulation< dim, spacedim > *tr
           = (dynamic_cast<parallel::distributed::Triangulation<dim,spacedim>*>
@@ -3512,7 +3514,7 @@ namespace internal
         {
           std::vector<dealii::types::global_dof_index> local_dof_indices;
 
-          typename DoFHandler<dim,spacedim>::active_cell_iterator
+          typename DoFHandlerType::active_cell_iterator
           cell = dof_handler->begin_active(),
           endc = dof_handler->end();
 
@@ -3622,7 +3624,7 @@ namespace internal
         tr->clear_user_flags ();
 
         // mark all own cells for transfer
-        for (typename DoFHandler<dim,spacedim>::active_cell_iterator cell = dof_handler->begin_active();
+        for (typename DoFHandlerType::active_cell_iterator cell = dof_handler->begin_active();
              cell != dof_handler->end(); ++cell)
           if (!cell->is_artificial())
             cell->set_user_flag();
@@ -3655,7 +3657,7 @@ namespace internal
         {
           std::vector<dealii::types::global_dof_index> local_dof_indices;
 
-          for (typename DoFHandler<dim,spacedim>::active_cell_iterator cell = dof_handler->begin_active();
+          for (typename DoFHandlerType::active_cell_iterator cell = dof_handler->begin_active();
                cell != dof_handler->end(); ++cell)
             if (!cell->is_artificial())
               {
@@ -3685,15 +3687,17 @@ namespace internal
 
 
 
-      template <int dim, int spacedim>
+      template <typename DoFHandlerType>
       std::vector<NumberCache>
-      ParallelDistributed<dim, spacedim>::
+      ParallelDistributed<DoFHandlerType>::
       distribute_mg_dofs () const
       {
 #ifndef DEAL_II_WITH_P4EST
         Assert (false, ExcNotImplemented());
         return std::vector<NumberCache>();
 #else
+        const unsigned int dim      = DoFHandlerType::dimension;
+        const unsigned int spacedim = DoFHandlerType::space_dimension;
 
         parallel::distributed::Triangulation< dim, spacedim > *tr
           = (dynamic_cast<parallel::distributed::Triangulation<dim,spacedim>*>
@@ -3739,7 +3743,7 @@ namespace internal
               {
                 std::vector<dealii::types::global_dof_index> local_dof_indices;
 
-                typename DoFHandler<dim,spacedim>::level_cell_iterator
+                typename DoFHandlerType::level_cell_iterator
                 cell = dof_handler->begin(level),
                 endc = dof_handler->end(level);
 
@@ -3864,7 +3868,7 @@ namespace internal
 
           // mark all ghost cells for transfer
           {
-            typename DoFHandler<dim,spacedim>::level_cell_iterator
+            typename DoFHandlerType::level_cell_iterator
             cell, endc = dof_handler->end();
             for (cell = dof_handler->begin(); cell != endc; ++cell)
               if (cell->level_subdomain_id() != dealii::numbers::artificial_subdomain_id
@@ -3895,7 +3899,7 @@ namespace internal
 #ifdef DEBUG
           // make sure we have removed all flags:
           {
-            typename DoFHandler<dim,spacedim>::level_cell_iterator
+            typename DoFHandlerType::level_cell_iterator
             cell, endc = dof_handler->end();
             for (cell = dof_handler->begin(); cell != endc; ++cell)
               if (cell->level_subdomain_id() != dealii::numbers::artificial_subdomain_id
@@ -3914,7 +3918,7 @@ namespace internal
         // check that we are really done
         {
           std::vector<dealii::types::global_dof_index> local_dof_indices;
-          typename DoFHandler<dim,spacedim>::level_cell_iterator
+          typename DoFHandlerType::level_cell_iterator
           cell, endc = dof_handler->end();
 
           for (cell = dof_handler->begin(); cell != endc; ++cell)
@@ -3939,9 +3943,9 @@ namespace internal
       }
 
 
-      template <int dim, int spacedim>
+      template <typename DoFHandlerType>
       NumberCache
-      ParallelDistributed<dim, spacedim>::
+      ParallelDistributed<DoFHandlerType>::
       renumber_dofs (const std::vector<dealii::types::global_dof_index> &new_numbers) const
       {
         (void)new_numbers;
@@ -3954,7 +3958,8 @@ namespace internal
 #ifndef DEAL_II_WITH_P4EST
         Assert (false, ExcNotImplemented());
 #else
-
+        const unsigned int dim      = DoFHandlerType::dimension;
+        const unsigned int spacedim = DoFHandlerType::space_dimension;
 
         // calculate new IndexSet. First try to find out if the new indices
         // are contiguous blocks. This avoids inserting each index
@@ -4046,7 +4051,7 @@ namespace internal
         {
           std::vector<dealii::types::global_dof_index> local_dof_indices;
 
-          typename DoFHandler<dim,spacedim>::active_cell_iterator
+          typename DoFHandlerType::active_cell_iterator
           cell = dof_handler->begin_active(),
           endc = dof_handler->end();
 
@@ -4093,7 +4098,7 @@ namespace internal
           tr->clear_user_flags ();
 
           // mark all own cells for transfer
-          typename DoFHandler<dim,spacedim>::active_cell_iterator
+          typename DoFHandlerType::active_cell_iterator
           cell, endc = dof_handler->end();
           for (cell = dof_handler->begin_active(); cell != endc; ++cell)
             if (!cell->is_artificial())
@@ -4176,9 +4181,9 @@ namespace internal
 
 
 
-      template <int dim, int spacedim>
+      template <typename DoFHandlerType>
       NumberCache
-      ParallelDistributed<dim,spacedim>::
+      ParallelDistributed<DoFHandlerType>::
       renumber_mg_dofs (const unsigned int                          /*level*/,
                         const std::vector<types::global_dof_index> &/*new_numbers*/) const
       {
index b7dc1f254d58e3eb97a947bef92beec4604b0008..34c7e1e33939adeeb72735557b6415283758876f 100644 (file)
@@ -31,7 +31,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension :  SPACE_DIMENSIONS
     template class ParallelShared<dealii::DoFHandler<deal_II_dimension,deal_II_space_dimension> >;
     template class ParallelShared<dealii::hp::DoFHandler<deal_II_dimension,deal_II_space_dimension> >;
 
-    template class ParallelDistributed<deal_II_dimension,deal_II_space_dimension>;
+    template class ParallelDistributed<dealii::DoFHandler<deal_II_dimension,deal_II_space_dimension> >;
     \}
     \}
     \}
index cc4bfb60a9fc17c0a5d43a09c9d06aa56e6f9775..450f8a62dcaa097964f1c33968a78ca66d2c0340 100644 (file)
@@ -1098,7 +1098,7 @@ namespace hp
     if (dynamic_cast<const parallel::shared::Triangulation< dim, spacedim>*> (&*this->tria) != nullptr)
       policy.reset (new internal::DoFHandler::Policy::ParallelShared<DoFHandler<dim,spacedim> >(*this));
     else if (dynamic_cast<const parallel::distributed::Triangulation< dim, spacedim >*> (&*this->tria) != nullptr)
-      //policy.reset (new internal::DoFHandler::Policy::ParallelDistributed<dim,spacedim>(*this));
+      //policy.reset (new internal::DoFHandler::Policy::ParallelDistributed<DoFHandler<dim,spacedim> >(*this));
       {
         Assert (false, ExcNotImplemented());
       }

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.