From 31a48f46279e0c1fb733281120742b797a358a3e Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 30 Jun 2017 11:39:37 -0600 Subject: [PATCH] Expose the ability to renumber MG dofs in the DoFHandlerPolicy interface. --- include/deal.II/dofs/dof_handler_policy.h | 33 ++++++++++++++ source/dofs/dof_handler_policy.cc | 53 ++++++++++++++++++++++- 2 files changed, 85 insertions(+), 1 deletion(-) diff --git a/include/deal.II/dofs/dof_handler_policy.h b/include/deal.II/dofs/dof_handler_policy.h index 9d717adb58..a2e48d66bf 100644 --- a/include/deal.II/dofs/dof_handler_policy.h +++ b/include/deal.II/dofs/dof_handler_policy.h @@ -90,6 +90,19 @@ namespace internal virtual NumberCache renumber_dofs (const std::vector &new_numbers) const = 0; + + /** + * Renumber multilevel degrees of freedom on one level of a multigrid + * hierarchy. The second argument specifies the set of new DoF + * indices. + * + * Return an updated NumberCache for the specified level of the + * DoFHandler after renumbering. + */ + virtual + NumberCache + renumber_mg_dofs (const unsigned int level, + const std::vector &new_numbers) const = 0; }; @@ -123,6 +136,12 @@ namespace internal NumberCache renumber_dofs (const std::vector &new_numbers) const; + // documentation is inherited + virtual + NumberCache + renumber_mg_dofs (const unsigned int level, + const std::vector &new_numbers) const; + protected: /** * The DoFHandler object on which this policy object works. @@ -130,6 +149,8 @@ namespace internal SmartPointer dof_handler; }; + + /** * This class implements the policy for operations when we use a * parallel::shared::Triangulation object. @@ -177,6 +198,12 @@ namespace internal NumberCache renumber_dofs (const std::vector &new_numbers) const; + // documentation is inherited + virtual + NumberCache + renumber_mg_dofs (const unsigned int level, + const std::vector &new_numbers) const; + private: /** * The DoFHandler object on which this policy object works. @@ -215,6 +242,12 @@ namespace internal NumberCache renumber_dofs (const std::vector &new_numbers) const; + // documentation is inherited + virtual + NumberCache + renumber_mg_dofs (const unsigned int level, + const std::vector &new_numbers) const; + private: /** * The DoFHandler object on which this policy object works. diff --git a/source/dofs/dof_handler_policy.cc b/source/dofs/dof_handler_policy.cc index ddfefe2960..5be7b4676f 100644 --- a/source/dofs/dof_handler_policy.cc +++ b/source/dofs/dof_handler_policy.cc @@ -1169,6 +1169,21 @@ namespace internal } + + template + NumberCache + Sequential:: + renumber_mg_dofs (const unsigned int level, + const std::vector &new_numbers) const + { + Implementation::renumber_mg_dofs (new_numbers, IndexSet(0), + *dof_handler, level, true); + + // return a sequential, complete index set + return NumberCache (new_numbers.size()); + } + + /* --------------------- class ParallelShared ---------------- */ @@ -1418,13 +1433,15 @@ namespace internal // this is not currently implemented; the algorithm should work // as above, though: first call the sequential numbering // algorithm, then re-enumerate subdomain-wise - Assert(false,ExcNotImplemented()); + Assert(false, ExcNotImplemented()); return std::vector(); } + + template NumberCache ParallelShared:: @@ -1561,6 +1578,22 @@ namespace internal #endif } + + + template + NumberCache + ParallelShared:: + renumber_mg_dofs (const unsigned int /*level*/, + const std::vector &/*new_numbers*/) const + { + // multigrid is not currently implemented for shared triangulations + Assert(false, ExcNotImplemented()); + + return NumberCache (); + } + + + /* --------------------- class ParallelDistributed ---------------- */ #ifdef DEAL_II_WITH_P4EST @@ -3101,6 +3134,24 @@ namespace internal return number_cache; } + + + + template + NumberCache + ParallelDistributed:: + renumber_mg_dofs (const unsigned int /*level*/, + const std::vector &/*new_numbers*/) const + { + // this is not currently implemented, but should be simple to do by + // just calling the function like in the sequential case just with + // an appropriate index set argument + Assert(false, ExcNotImplemented()); + + return NumberCache (); + } + + } } } -- 2.39.5