From 4b69603925bdea200268216a31a89e6995831c7c Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 6 Jul 2017 13:18:17 -0600 Subject: [PATCH] Provide the ParallelShared policy with a DoFHandlerType template argument. Also instantiate it for hp::DoFHandler (which miraculously works already without any further changes!). --- include/deal.II/dofs/dof_handler_policy.h | 8 +++---- source/dofs/dof_handler.cc | 6 ++--- source/dofs/dof_handler_policy.cc | 28 ++++++++++++++--------- source/dofs/dof_handler_policy.inst.in | 9 +++++--- 4 files changed, 30 insertions(+), 21 deletions(-) diff --git a/include/deal.II/dofs/dof_handler_policy.h b/include/deal.II/dofs/dof_handler_policy.h index a2e48d66bf..48a465b2bc 100644 --- a/include/deal.II/dofs/dof_handler_policy.h +++ b/include/deal.II/dofs/dof_handler_policy.h @@ -155,8 +155,8 @@ namespace internal * This class implements the policy for operations when we use a * parallel::shared::Triangulation object. */ - template - class ParallelShared : public PolicyBase + template + class ParallelShared : public PolicyBase { 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 &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 > dof_handler; + SmartPointer dof_handler; }; diff --git a/source/dofs/dof_handler.cc b/source/dofs/dof_handler.cc index 7c3ea27e25..cea077c60b 100644 --- a/source/dofs/dof_handler.cc +++ b/source/dofs/dof_handler.cc @@ -71,7 +71,7 @@ namespace internal policy_name = "Policy::Sequential<"; else if (dynamic_cast*>(&policy)) policy_name = "Policy::ParallelDistributed<"; - else if (dynamic_cast*>(&policy)) + else if (dynamic_cast >*>(&policy)) policy_name = "Policy::ParallelShared<"; else AssertThrow(false, ExcNotImplemented()); @@ -658,7 +658,7 @@ DoFHandler::DoFHandler (const Triangulation &tria) if (dynamic_cast*> (&tria) != nullptr) - policy.reset (new internal::DoFHandler::Policy::ParallelShared(*this)); + policy.reset (new internal::DoFHandler::Policy::ParallelShared >(*this)); else if (dynamic_cast*> (&tria) == nullptr) @@ -705,7 +705,7 @@ initialize(const Triangulation &t, if (dynamic_cast*> (&t) != nullptr) - policy.reset (new internal::DoFHandler::Policy::ParallelShared(*this)); + policy.reset (new internal::DoFHandler::Policy::ParallelShared >(*this)); else if (dynamic_cast*> (&t) == nullptr) diff --git a/source/dofs/dof_handler_policy.cc b/source/dofs/dof_handler_policy.cc index 3619d0e4bc..2ce49335a1 100644 --- a/source/dofs/dof_handler_policy.cc +++ b/source/dofs/dof_handler_policy.cc @@ -2217,9 +2217,9 @@ namespace internal /* --------------------- class ParallelShared ---------------- */ - template - ParallelShared:: - ParallelShared (dealii::DoFHandler &dof_handler) + template + ParallelShared:: + ParallelShared (DoFHandlerType &dof_handler) : dof_handler (&dof_handler) {} @@ -2300,11 +2300,14 @@ namespace internal - template + template NumberCache - ParallelShared:: + ParallelShared:: distribute_dofs () const { + const unsigned int dim = DoFHandlerType::dimension; + const unsigned int spacedim = DoFHandlerType::space_dimension; + const parallel::shared::Triangulation *tr = (dynamic_cast*> (&this->dof_handler->get_triangulation())); Assert(tr != nullptr, ExcInternalError()); @@ -2455,9 +2458,9 @@ namespace internal - template + template std::vector - ParallelShared:: + ParallelShared:: distribute_mg_dofs () const { // this is not currently implemented; the algorithm should work @@ -2472,9 +2475,9 @@ namespace internal - template + template NumberCache - ParallelShared:: + ParallelShared:: renumber_dofs (const std::vector &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 *tr = @@ -2610,9 +2616,9 @@ namespace internal - template + template NumberCache - ParallelShared:: + ParallelShared:: renumber_mg_dofs (const unsigned int /*level*/, const std::vector &/*new_numbers*/) const { diff --git a/source/dofs/dof_handler_policy.inst.in b/source/dofs/dof_handler_policy.inst.in index c9cddc1536..1e394b607b 100644 --- a/source/dofs/dof_handler_policy.inst.in +++ b/source/dofs/dof_handler_policy.inst.in @@ -25,14 +25,16 @@ for (deal_II_dimension : DIMENSIONS) template class PolicyBase; template class Sequential >; template class Sequential >; - template class ParallelShared; + template class ParallelShared >; + 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 ParallelShared >; + template class ParallelShared >; template class ParallelDistributed; #endif @@ -40,7 +42,8 @@ for (deal_II_dimension : DIMENSIONS) template class PolicyBase<1,3>; template class Sequential >; template class Sequential >; - template class ParallelShared<1,3>; + template class ParallelShared >; + template class ParallelShared >; template class ParallelDistributed<1,3>; #endif \} -- 2.39.5