]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Provide the ParallelShared policy with a DoFHandlerType template argument.
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 6 Jul 2017 19:18:17 +0000 (13:18 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Sun, 9 Jul 2017 15:54:50 +0000 (09:54 -0600)
Also instantiate it for hp::DoFHandler (which miraculously works
already without any further changes!).

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

index a2e48d66bf51a61152469fe74ebffd4ce6f351ff..48a465b2bc833e647533e82dd58bcbf0d97cc287 100644 (file)
@@ -155,8 +155,8 @@ namespace internal
        * This class implements the policy for operations when we use a
        * parallel::shared::Triangulation object.
        */
-      template <int dim, int spacedim>
-      class ParallelShared : public PolicyBase<dim,spacedim>
+      template <typename DoFHandlerType>
+      class ParallelShared : public PolicyBase<DoFHandlerType::dimension,DoFHandlerType::space_dimension>
       {
       public:
         /**
@@ -164,7 +164,7 @@ namespace internal
          * @param dof_handler The DoFHandler object upon which this
          *   policy class is supposed to work.
          */
-        ParallelShared (dealii::DoFHandler<dim,spacedim> &dof_handler);
+        ParallelShared (DoFHandlerType &dof_handler);
 
         /**
          * Distribute degrees of freedom on the object given as first
@@ -208,7 +208,7 @@ namespace internal
         /**
          * The DoFHandler object on which this policy object works.
          */
-        SmartPointer<dealii::DoFHandler<dim,spacedim> > dof_handler;
+        SmartPointer<DoFHandlerType> dof_handler;
       };
 
 
index 7c3ea27e25be936225c5da2158642b9337361f81..cea077c60bb8961d128681b7f750d9e416914ab5 100644 (file)
@@ -71,7 +71,7 @@ namespace internal
       policy_name = "Policy::Sequential<";
     else if (dynamic_cast<const typename dealii::internal::DoFHandler::Policy::ParallelDistributed<dim,spacedim>*>(&policy))
       policy_name = "Policy::ParallelDistributed<";
-    else if (dynamic_cast<const typename dealii::internal::DoFHandler::Policy::ParallelShared<dim,spacedim>*>(&policy))
+    else if (dynamic_cast<const typename dealii::internal::DoFHandler::Policy::ParallelShared<dealii::DoFHandler<dim,spacedim> >*>(&policy))
       policy_name = "Policy::ParallelShared<";
     else
       AssertThrow(false, ExcNotImplemented());
@@ -658,7 +658,7 @@ DoFHandler<dim,spacedim>::DoFHandler (const Triangulation<dim,spacedim> &tria)
   if (dynamic_cast<const parallel::shared::Triangulation< dim, spacedim>*>
       (&tria)
       != nullptr)
-    policy.reset (new internal::DoFHandler::Policy::ParallelShared<dim,spacedim>(*this));
+    policy.reset (new internal::DoFHandler::Policy::ParallelShared<DoFHandler<dim,spacedim> >(*this));
   else if (dynamic_cast<const parallel::distributed::Triangulation< dim, spacedim >*>
            (&tria)
            == nullptr)
@@ -705,7 +705,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<dim,spacedim>(*this));
+    policy.reset (new internal::DoFHandler::Policy::ParallelShared<DoFHandler<dim,spacedim> >(*this));
   else if (dynamic_cast<const parallel::distributed::Triangulation< dim, spacedim >*>
            (&t)
            == nullptr)
index 3619d0e4bcfedad1ce96e9f2c5a204fd65261cc2..2ce49335a102c4a49e47638becfeda40b42be594 100644 (file)
@@ -2217,9 +2217,9 @@ namespace internal
       /* --------------------- class ParallelShared ---------------- */
 
 
-      template <int dim, int spacedim>
-      ParallelShared<dim,spacedim>::
-      ParallelShared (dealii::DoFHandler<dim,spacedim> &dof_handler)
+      template <class DoFHandlerType>
+      ParallelShared<DoFHandlerType>::
+      ParallelShared (DoFHandlerType &dof_handler)
         :
         dof_handler (&dof_handler)
       {}
@@ -2300,11 +2300,14 @@ namespace internal
 
 
 
-      template <int dim, int spacedim>
+      template <class DoFHandlerType>
       NumberCache
-      ParallelShared<dim,spacedim>::
+      ParallelShared<DoFHandlerType>::
       distribute_dofs () const
       {
+        const unsigned int dim      = DoFHandlerType::dimension;
+        const unsigned int spacedim = DoFHandlerType::space_dimension;
+
         const parallel::shared::Triangulation<dim, spacedim> *tr =
           (dynamic_cast<const parallel::shared::Triangulation<dim, spacedim>*> (&this->dof_handler->get_triangulation()));
         Assert(tr != nullptr, ExcInternalError());
@@ -2455,9 +2458,9 @@ namespace internal
 
 
 
-      template <int dim, int spacedim>
+      template <class DoFHandlerType>
       std::vector<NumberCache>
-      ParallelShared<dim,spacedim>::
+      ParallelShared<DoFHandlerType>::
       distribute_mg_dofs () const
       {
         // this is not currently implemented; the algorithm should work
@@ -2472,9 +2475,9 @@ namespace internal
 
 
 
-      template <int dim, int spacedim>
+      template <class DoFHandlerType>
       NumberCache
-      ParallelShared<dim,spacedim>::
+      ParallelShared<DoFHandlerType>::
       renumber_dofs (const std::vector<types::global_dof_index> &new_numbers) const
       {
 
@@ -2483,6 +2486,9 @@ namespace internal
         Assert (false, ExcNotImplemented());
         return NumberCache();
 #else
+        const unsigned int dim      = DoFHandlerType::dimension;
+        const unsigned int spacedim = DoFHandlerType::space_dimension;
+
         // Similar to distribute_dofs() we need to have a special treatment in
         // case artificial cells are present.
         const parallel::shared::Triangulation<dim, spacedim> *tr =
@@ -2610,9 +2616,9 @@ namespace internal
 
 
 
-      template <int dim, int spacedim>
+      template <class DoFHandlerType>
       NumberCache
-      ParallelShared<dim,spacedim>::
+      ParallelShared<DoFHandlerType>::
       renumber_mg_dofs (const unsigned int                          /*level*/,
                         const std::vector<types::global_dof_index> &/*new_numbers*/) const
       {
index c9cddc153685eaa91cca2c249d671b89aec4944d..1e394b607bc9585cc40a57ef169164bc69953d49 100644 (file)
@@ -25,14 +25,16 @@ for (deal_II_dimension : DIMENSIONS)
     template class PolicyBase<deal_II_dimension,deal_II_dimension>;
     template class Sequential<dealii::DoFHandler<deal_II_dimension,deal_II_dimension> >;
     template class Sequential<dealii::hp::DoFHandler<deal_II_dimension,deal_II_dimension> >;
-    template class ParallelShared<deal_II_dimension,deal_II_dimension>;
+    template class ParallelShared<dealii::DoFHandler<deal_II_dimension,deal_II_dimension> >;
+    template class ParallelShared<dealii::hp::DoFHandler<deal_II_dimension,deal_II_dimension> >;
     template class ParallelDistributed<deal_II_dimension,deal_II_dimension>;
 
 #if deal_II_dimension==1 || deal_II_dimension==2
     template class PolicyBase<deal_II_dimension,deal_II_dimension+1>;
     template class Sequential<dealii::DoFHandler<deal_II_dimension,deal_II_dimension+1> >;
     template class Sequential<dealii::hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> >;
-    template class ParallelShared<deal_II_dimension,deal_II_dimension+1>;
+    template class ParallelShared<dealii::DoFHandler<deal_II_dimension,deal_II_dimension+1> >;
+    template class ParallelShared<dealii::hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> >;
     template class ParallelDistributed<deal_II_dimension,deal_II_dimension+1>;
 #endif
 
@@ -40,7 +42,8 @@ for (deal_II_dimension : DIMENSIONS)
     template class PolicyBase<1,3>;
     template class Sequential<dealii::DoFHandler<1,3> >;
     template class Sequential<dealii::hp::DoFHandler<1,3> >;
-    template class ParallelShared<1,3>;
+    template class ParallelShared<dealii::DoFHandler<1,3> >;
+    template class ParallelShared<dealii::hp::DoFHandler<1,3> >;
     template class ParallelDistributed<1,3>;
 #endif
     \}

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.