From c0b7253f4cca430429c2635d13b9879f8c0f6c81 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Fri, 20 Oct 2017 18:31:33 +0200 Subject: [PATCH] Add dummy locally_owned_mg_dofs() to hp::DoFHandler for convenience. --- include/deal.II/hp/dof_handler.h | 57 ++++++++++++++++++++++++++++++-- source/dofs/dof_tools.inst.in | 31 +++++++++++++++++ 2 files changed, 85 insertions(+), 3 deletions(-) diff --git a/include/deal.II/hp/dof_handler.h b/include/deal.II/hp/dof_handler.h index db1023ee10..e66fabd333 100644 --- a/include/deal.II/hp/dof_handler.h +++ b/include/deal.II/hp/dof_handler.h @@ -544,8 +544,8 @@ namespace hp /** * The number of multilevel dofs on given level. Since hp::DoFHandler does - * not support multilevel methods yet, this function returns - * numbers::invalid_unsigned int independent of its argument. + * not support multilevel methods yet, this function throws an exception + * ExcNotImplemented() independent of its argument. */ types::global_dof_index n_dofs(const unsigned int level) const; @@ -599,7 +599,6 @@ namespace hp */ const IndexSet &locally_owned_dofs() const; - /** * Return a vector that stores the locally owned DoFs of each processor. * If you are only interested in the number of elements each processor @@ -626,6 +625,23 @@ namespace hp const std::vector & n_locally_owned_dofs_per_processor () const; + /** + * Return an IndexSet describing the set of locally owned DoFs used for + * the given multigrid level. Since hp::DoFHandler does not support + * multilevel methods yet, this function throws an exception + * ExcNotImplemented() independent of its argument. + */ + const IndexSet &locally_owned_mg_dofs(const unsigned int level) const; + + /** + * Return a vector that stores the locally owned level DoFs of each + * processor on the given level @p level. Since hp::DoFHandler does not + * support multilevel methods yet, this function throws an exception + * ExcNotImplemented() independent of its argument. + */ + const std::vector & + locally_owned_mg_dofs_per_processor (const unsigned int level) const; + /** * Return a constant reference to the set of finite element objects that * are used by this @p DoFHandler. @@ -821,6 +837,13 @@ namespace hp */ dealii::internal::DoFHandler::NumberCache number_cache; + /** + * A structure that contains all sorts of numbers that characterize the + * degrees of freedom on multigrid levels. Since multigrid is not currently + * supported, this table is not filled with valid entries. + */ + std::vector mg_number_cache; + /** * Array to store the indices for degrees of freedom located at vertices. * @@ -929,6 +952,7 @@ namespace hp ar &vertex_dofs; ar &vertex_dof_offsets; ar &number_cache; + ar &mg_number_cache; ar &levels; ar &faces; ar &has_children; @@ -951,6 +975,7 @@ namespace hp ar &vertex_dofs; ar &vertex_dof_offsets; ar &number_cache; + ar &mg_number_cache; // boost::serialization can restore pointers just fine, but if the // pointer object still points to something useful, that object is not @@ -998,6 +1023,7 @@ namespace hp types::global_dof_index DoFHandler::n_dofs (const unsigned int) const { + Assert(false, ExcNotImplemented()); return numbers::invalid_dof_index; } @@ -1039,6 +1065,31 @@ namespace hp + template + const IndexSet & + DoFHandler::locally_owned_mg_dofs (const unsigned int level) const + { + Assert(false, ExcNotImplemented()); + (void)level; + Assert(level < this->get_triangulation().n_global_levels(), + ExcMessage("invalid level in locally_owned_mg_dofs")); + return mg_number_cache[0].locally_owned_dofs; + } + + + template + const std::vector & + DoFHandler::locally_owned_mg_dofs_per_processor (const unsigned int level) const + { + Assert(false, ExcNotImplemented()); + (void)level; + Assert(level < this->get_triangulation().n_global_levels(), + ExcMessage("invalid level in locally_owned_mg_dofs_per_processor")); + return mg_number_cache[0].locally_owned_dofs_per_processor; + } + + + template inline const hp::FECollection & diff --git a/source/dofs/dof_tools.inst.in b/source/dofs/dof_tools.inst.in index 60da486720..ac51e0fae9 100644 --- a/source/dofs/dof_tools.inst.in +++ b/source/dofs/dof_tools.inst.in @@ -23,6 +23,18 @@ for (deal_II_dimension : DIMENSIONS) DoFTools::extract_locally_relevant_dofs > (const DoFHandler & dof_handler, IndexSet & dof_set); + template + void + DoFTools::extract_locally_relevant_level_dofs > + (const DoFHandler & dof_handler, + const unsigned int level, + IndexSet & dof_set); + template + void + DoFTools::extract_locally_relevant_level_dofs > + (const hp::DoFHandler & dof_handler, + const unsigned int level, + IndexSet & dof_set); #endif #if deal_II_dimension > 2 @@ -31,6 +43,18 @@ for (deal_II_dimension : DIMENSIONS) DoFTools::extract_locally_relevant_dofs > (const DoFHandler & dof_handler, IndexSet & dof_set); + template + void + DoFTools::extract_locally_relevant_level_dofs > + (const DoFHandler & dof_handler, + const unsigned int level, + IndexSet & dof_set); + template + void + DoFTools::extract_locally_relevant_level_dofs > + (const hp::DoFHandler & dof_handler, + const unsigned int level, + IndexSet & dof_set); #endif template @@ -229,6 +253,13 @@ for (deal_II_dimension : DIMENSIONS) const unsigned int level, IndexSet & dof_set); + template + void + DoFTools::extract_locally_relevant_level_dofs > + (const hp::DoFHandler & dof_handler, + const unsigned int level, + IndexSet & dof_set); + template void DoFTools::extract_constant_modes > -- 2.39.5