From: Wolfgang Bangerth Date: Mon, 17 Jul 2017 23:45:51 +0000 (-0600) Subject: Provide the ParallelDistributed policy with a DoFHandler template argument. X-Git-Tag: v9.0.0-rc1~1407^2~8 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3db0ed406370eb0833fce6417fa590e6e10f369;p=dealii.git Provide the ParallelDistributed policy with a DoFHandler template argument. --- diff --git a/include/deal.II/distributed/tria.h b/include/deal.II/distributed/tria.h index de8a9ec736..3586348ae1 100644 --- a/include/deal.II/distributed/tria.h +++ b/include/deal.II/distributed/tria.h @@ -58,7 +58,7 @@ namespace internal { namespace Policy { - template class ParallelDistributed; + template class ParallelDistributed; } } } @@ -890,7 +890,7 @@ namespace parallel std::vector mark_locally_active_vertices_on_level(const int level) const; - template friend class dealii::internal::DoFHandler::Policy::ParallelDistributed; + template friend class dealii::internal::DoFHandler::Policy::ParallelDistributed; template friend class dealii::FETools::internal::ExtrapolateImplementation; }; diff --git a/include/deal.II/dofs/dof_handler_policy.h b/include/deal.II/dofs/dof_handler_policy.h index 48a465b2bc..03cf46e0b3 100644 --- a/include/deal.II/dofs/dof_handler_policy.h +++ b/include/deal.II/dofs/dof_handler_policy.h @@ -216,8 +216,8 @@ namespace internal * This class implements the policy for operations when we use a * parallel::distributed::Triangulation object. */ - template - class ParallelDistributed : public PolicyBase + template + class ParallelDistributed : public PolicyBase { 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 &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 > dof_handler; + SmartPointer dof_handler; }; } } diff --git a/source/dofs/dof_handler.cc b/source/dofs/dof_handler.cc index 62c27aa897..a43401817f 100644 --- a/source/dofs/dof_handler.cc +++ b/source/dofs/dof_handler.cc @@ -69,7 +69,8 @@ namespace internal if (dynamic_cast >*>(&policy) || dynamic_cast >*>(&policy)) policy_name = "Policy::Sequential<"; - else if (dynamic_cast*>(&policy)) + else if (dynamic_cast >*>(&policy) + || dynamic_cast >*>(&policy)) policy_name = "Policy::ParallelDistributed<"; else if (dynamic_cast >*>(&policy)) policy_name = "Policy::ParallelShared<"; @@ -664,7 +665,7 @@ DoFHandler::DoFHandler (const Triangulation &tria) == nullptr) policy.reset (new internal::DoFHandler::Policy::Sequential >(*this)); else - policy.reset (new internal::DoFHandler::Policy::ParallelDistributed(*this)); + policy.reset (new internal::DoFHandler::Policy::ParallelDistributed >(*this)); } @@ -703,7 +704,7 @@ initialize(const Triangulation &t, if (dynamic_cast*> (&t) != nullptr) policy.reset (new internal::DoFHandler::Policy::ParallelShared >(*this)); else if (dynamic_cast*> (&t) != nullptr) - policy.reset (new internal::DoFHandler::Policy::ParallelDistributed(*this)); + policy.reset (new internal::DoFHandler::Policy::ParallelDistributed >(*this)); else policy.reset (new internal::DoFHandler::Policy::Sequential >(*this)); diff --git a/source/dofs/dof_handler_policy.cc b/source/dofs/dof_handler_policy.cc index 38ce8a72a3..d67f56b614 100644 --- a/source/dofs/dof_handler_policy.cc +++ b/source/dofs/dof_handler_policy.cc @@ -3466,9 +3466,9 @@ namespace internal - template - ParallelDistributed:: - ParallelDistributed (dealii::DoFHandler &dof_handler) + template + ParallelDistributed:: + ParallelDistributed (DoFHandlerType &dof_handler) : dof_handler (&dof_handler) {} @@ -3478,9 +3478,9 @@ namespace internal - template + template NumberCache - ParallelDistributed:: + ParallelDistributed:: 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*> @@ -3512,7 +3514,7 @@ namespace internal { std::vector local_dof_indices; - typename DoFHandler::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::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 local_dof_indices; - for (typename DoFHandler::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 + template std::vector - ParallelDistributed:: + ParallelDistributed:: distribute_mg_dofs () const { #ifndef DEAL_II_WITH_P4EST Assert (false, ExcNotImplemented()); return std::vector(); #else + const unsigned int dim = DoFHandlerType::dimension; + const unsigned int spacedim = DoFHandlerType::space_dimension; parallel::distributed::Triangulation< dim, spacedim > *tr = (dynamic_cast*> @@ -3739,7 +3743,7 @@ namespace internal { std::vector local_dof_indices; - typename DoFHandler::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::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::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 local_dof_indices; - typename DoFHandler::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 + template NumberCache - ParallelDistributed:: + ParallelDistributed:: renumber_dofs (const std::vector &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 local_dof_indices; - typename DoFHandler::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::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 + template NumberCache - ParallelDistributed:: + ParallelDistributed:: 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 b7dc1f254d..34c7e1e339 100644 --- a/source/dofs/dof_handler_policy.inst.in +++ b/source/dofs/dof_handler_policy.inst.in @@ -31,7 +31,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS template class ParallelShared >; template class ParallelShared >; - template class ParallelDistributed; + template class ParallelDistributed >; \} \} \} diff --git a/source/hp/dof_handler.cc b/source/hp/dof_handler.cc index cc4bfb60a9..450f8a62dc 100644 --- a/source/hp/dof_handler.cc +++ b/source/hp/dof_handler.cc @@ -1098,7 +1098,7 @@ namespace hp if (dynamic_cast*> (&*this->tria) != nullptr) policy.reset (new internal::DoFHandler::Policy::ParallelShared >(*this)); else if (dynamic_cast*> (&*this->tria) != nullptr) - //policy.reset (new internal::DoFHandler::Policy::ParallelDistributed(*this)); + //policy.reset (new internal::DoFHandler::Policy::ParallelDistributed >(*this)); { Assert (false, ExcNotImplemented()); }