From 762d03402a62fcf85ff4dfdb89a112d957d82c6f Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 27 Jun 2017 08:14:53 -0600 Subject: [PATCH] Make the DoFHandler a template type of the Sequential policy. 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 | 8 ++++---- source/dofs/dof_handler.cc | 6 +++--- source/dofs/dof_handler_policy.cc | 24 ++++++++++++----------- source/dofs/dof_handler_policy.inst.in | 6 +++--- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/include/deal.II/dofs/dof_handler_policy.h b/include/deal.II/dofs/dof_handler_policy.h index a4d185a29b..9d717adb58 100644 --- a/include/deal.II/dofs/dof_handler_policy.h +++ b/include/deal.II/dofs/dof_handler_policy.h @@ -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 - class Sequential : public PolicyBase + template + class Sequential : public PolicyBase { 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 &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 > dof_handler; + SmartPointer dof_handler; }; /** diff --git a/source/dofs/dof_handler.cc b/source/dofs/dof_handler.cc index db82856bec..6022ac2af6 100644 --- a/source/dofs/dof_handler.cc +++ b/source/dofs/dof_handler.cc @@ -66,7 +66,7 @@ namespace internal std::string policy_to_string(const dealii::internal::DoFHandler::Policy::PolicyBase &policy) { std::string policy_name; - if (dynamic_cast*>(&policy)) + if (dynamic_cast >*>(&policy)) policy_name = "Policy::Sequential<"; else if (dynamic_cast*>(&policy)) policy_name = "Policy::ParallelDistributed<"; @@ -663,7 +663,7 @@ DoFHandler::DoFHandler (const Triangulation &tria) else if (dynamic_cast*> (&tria) == nullptr) - policy.reset (new internal::DoFHandler::Policy::Sequential(*this)); + policy.reset (new internal::DoFHandler::Policy::Sequential >(*this)); else policy.reset (new internal::DoFHandler::Policy::ParallelDistributed(*this)); } @@ -710,7 +710,7 @@ initialize(const Triangulation &t, else if (dynamic_cast*> (&t) == nullptr) - policy.reset (new internal::DoFHandler::Policy::Sequential(*this)); + policy.reset (new internal::DoFHandler::Policy::Sequential >(*this)); else policy.reset (new internal::DoFHandler::Policy::ParallelDistributed(*this)); diff --git a/source/dofs/dof_handler_policy.cc b/source/dofs/dof_handler_policy.cc index c3da27fbaa..66a4aca156 100644 --- a/source/dofs/dof_handler_policy.cc +++ b/source/dofs/dof_handler_policy.cc @@ -951,18 +951,18 @@ namespace internal - template - Sequential:: - Sequential (dealii::DoFHandler &dof_handler) + template + Sequential:: + Sequential (DoFHandlerType &dof_handler) : dof_handler (&dof_handler) {} - template + template NumberCache - Sequential:: + Sequential:: distribute_dofs () const { const types::global_dof_index n_dofs = @@ -975,15 +975,16 @@ namespace internal - template + template std::vector - Sequential:: + Sequential:: distribute_mg_dofs () const { std::vector user_flags; dof_handler->get_triangulation().save_user_flags (user_flags); - const_cast&>(dof_handler->get_triangulation()).clear_user_flags (); + const_cast&> + (dof_handler->get_triangulation()).clear_user_flags (); std::vector 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&>(dof_handler->get_triangulation()).load_user_flags (user_flags); + const_cast&> + (dof_handler->get_triangulation()).load_user_flags (user_flags); return number_caches; } - template + template NumberCache - Sequential:: + Sequential:: renumber_dofs (const std::vector &new_numbers) const { Implementation::renumber_dofs (new_numbers, IndexSet(0), diff --git a/source/dofs/dof_handler_policy.inst.in b/source/dofs/dof_handler_policy.inst.in index 7b472d39f4..1c75b7be97 100644 --- a/source/dofs/dof_handler_policy.inst.in +++ b/source/dofs/dof_handler_policy.inst.in @@ -23,20 +23,20 @@ for (deal_II_dimension : DIMENSIONS) namespace Policy \{ template class PolicyBase; - template class Sequential; + template class Sequential >; template class ParallelShared; template class ParallelDistributed; #if deal_II_dimension==1 || deal_II_dimension==2 template class PolicyBase; - template class Sequential; + template class Sequential >; template class ParallelShared; template class ParallelDistributed; #endif #if deal_II_dimension==3 template class PolicyBase<1,3>; - template class Sequential<1,3>; + template class Sequential >; template class ParallelShared<1,3>; template class ParallelDistributed<1,3>; #endif -- 2.39.5