]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make the DoFHandler a template type of the Sequential policy.
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 27 Jun 2017 14:14:53 +0000 (08:14 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 28 Jun 2017 16:01:20 +0000 (10:01 -0600)
Also adjust all of the places where the class is used.

This change by itself is not useful, but will become useful when also
using the policy class from hp::DoFHandler. Similar changes will at a
later time be made for the ParallelShared and ParallelDistributed
policies.

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 a4d185a29be8a4a50abdbd13b6701113d32d78da..9d717adb58357d2c86f562f068e97460ee805f60 100644 (file)
@@ -97,8 +97,8 @@ namespace internal
        * This class implements the default policy for sequential operations,
        * i.e. for the case where all cells get degrees of freedom.
        */
-      template <int dim, int spacedim>
-      class Sequential : public PolicyBase<dim,spacedim>
+      template <typename DoFHandlerType>
+      class Sequential : public PolicyBase<DoFHandlerType::dimension,DoFHandlerType::space_dimension>
       {
       public:
         /**
@@ -106,7 +106,7 @@ namespace internal
          * @param dof_handler The DoFHandler object upon which this
          *   policy class is supposed to work.
          */
-        Sequential (dealii::DoFHandler<dim,spacedim> &dof_handler);
+        Sequential (DoFHandlerType &dof_handler);
 
         // documentation is inherited
         virtual
@@ -127,7 +127,7 @@ namespace internal
         /**
          * The DoFHandler object on which this policy object works.
          */
-        SmartPointer<dealii::DoFHandler<dim,spacedim> > dof_handler;
+        SmartPointer<DoFHandlerType> dof_handler;
       };
 
       /**
index db82856becd93477ebb833c666903788cda5ed35..6022ac2af6e18b7428049c783dee570e537e5633 100644 (file)
@@ -66,7 +66,7 @@ namespace internal
   std::string policy_to_string(const dealii::internal::DoFHandler::Policy::PolicyBase<dim,spacedim> &policy)
   {
     std::string policy_name;
-    if (dynamic_cast<const typename dealii::internal::DoFHandler::Policy::Sequential<dim,spacedim>*>(&policy))
+    if (dynamic_cast<const typename dealii::internal::DoFHandler::Policy::Sequential<dealii::DoFHandler<dim,spacedim> >*>(&policy))
       policy_name = "Policy::Sequential<";
     else if (dynamic_cast<const typename dealii::internal::DoFHandler::Policy::ParallelDistributed<dim,spacedim>*>(&policy))
       policy_name = "Policy::ParallelDistributed<";
@@ -663,7 +663,7 @@ DoFHandler<dim,spacedim>::DoFHandler (const Triangulation<dim,spacedim> &tria)
   else if (dynamic_cast<const parallel::distributed::Triangulation< dim, spacedim >*>
            (&tria)
            == nullptr)
-    policy.reset (new internal::DoFHandler::Policy::Sequential<dim,spacedim>(*this));
+    policy.reset (new internal::DoFHandler::Policy::Sequential<DoFHandler<dim,spacedim> >(*this));
   else
     policy.reset (new internal::DoFHandler::Policy::ParallelDistributed<dim,spacedim>(*this));
 }
@@ -710,7 +710,7 @@ initialize(const Triangulation<dim,spacedim> &t,
   else if (dynamic_cast<const parallel::distributed::Triangulation< dim, spacedim >*>
            (&t)
            == nullptr)
-    policy.reset (new internal::DoFHandler::Policy::Sequential<dim,spacedim>(*this));
+    policy.reset (new internal::DoFHandler::Policy::Sequential<DoFHandler<dim,spacedim> >(*this));
   else
     policy.reset (new internal::DoFHandler::Policy::ParallelDistributed<dim,spacedim>(*this));
 
index c3da27fbaa06a6dc1bb833927ee05101a11efd60..66a4aca15693b40893bd80dc45512fe2f85458e5 100644 (file)
@@ -951,18 +951,18 @@ namespace internal
 
 
 
-      template <int dim, int spacedim>
-      Sequential<dim,spacedim>::
-      Sequential (dealii::DoFHandler<dim,spacedim> &dof_handler)
+      template <typename DoFHandlerType>
+      Sequential<DoFHandlerType>::
+      Sequential (DoFHandlerType &dof_handler)
         :
         dof_handler (&dof_handler)
       {}
 
 
 
-      template <int dim, int spacedim>
+      template <typename DoFHandlerType>
       NumberCache
-      Sequential<dim,spacedim>::
+      Sequential<DoFHandlerType>::
       distribute_dofs () const
       {
         const types::global_dof_index n_dofs =
@@ -975,15 +975,16 @@ namespace internal
 
 
 
-      template <int dim, int spacedim>
+      template <typename DoFHandlerType>
       std::vector<NumberCache>
-      Sequential<dim,spacedim>::
+      Sequential<DoFHandlerType>::
       distribute_mg_dofs () const
       {
         std::vector<bool> user_flags;
         dof_handler->get_triangulation().save_user_flags (user_flags);
 
-        const_cast<dealii::Triangulation<dim, spacedim>&>(dof_handler->get_triangulation()).clear_user_flags ();
+        const_cast<dealii::Triangulation<DoFHandlerType::dimension, DoFHandlerType::space_dimension>&>
+        (dof_handler->get_triangulation()).clear_user_flags ();
 
         std::vector<NumberCache> number_caches;
         number_caches.reserve (dof_handler->get_triangulation().n_levels());
@@ -998,16 +999,17 @@ namespace internal
             number_caches.emplace_back (NumberCache(n_level_dofs));
           }
 
-        const_cast<dealii::Triangulation<dim, spacedim>&>(dof_handler->get_triangulation()).load_user_flags (user_flags);
+        const_cast<dealii::Triangulation<DoFHandlerType::dimension, DoFHandlerType::space_dimension>&>
+        (dof_handler->get_triangulation()).load_user_flags (user_flags);
 
         return number_caches;
       }
 
 
 
-      template <int dim, int spacedim>
+      template <typename DoFHandlerType>
       NumberCache
-      Sequential<dim,spacedim>::
+      Sequential<DoFHandlerType>::
       renumber_dofs (const std::vector<types::global_dof_index> &new_numbers) const
       {
         Implementation::renumber_dofs (new_numbers, IndexSet(0),
index 7b472d39f4ee4084b38e5d4aa13c9ff6b2508111..1c75b7be975d4fa2d329a122e85327e98fd22fcc 100644 (file)
@@ -23,20 +23,20 @@ for (deal_II_dimension : DIMENSIONS)
     namespace Policy
     \{
     template class PolicyBase<deal_II_dimension,deal_II_dimension>;
-    template class Sequential<deal_II_dimension,deal_II_dimension>;
+    template class Sequential<dealii::DoFHandler<deal_II_dimension,deal_II_dimension> >;
     template class ParallelShared<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<deal_II_dimension,deal_II_dimension+1>;
+    template class Sequential<dealii::DoFHandler<deal_II_dimension,deal_II_dimension+1> >;
     template class ParallelShared<deal_II_dimension,deal_II_dimension+1>;
     template class ParallelDistributed<deal_II_dimension,deal_II_dimension+1>;
 #endif
 
 #if deal_II_dimension==3
     template class PolicyBase<1,3>;
-    template class Sequential<1,3>;
+    template class Sequential<dealii::DoFHandler<1,3> >;
     template class ParallelShared<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.