From: Marc Fehling Date: Fri, 13 Nov 2020 02:40:20 +0000 (-0700) Subject: Prefer basic DoFHandler over deprecated hp::DoFHandler. X-Git-Tag: v9.3.0-rc1~898^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e16f53e5fce63cfc91522bfa9ca366583501ed4;p=dealii.git Prefer basic DoFHandler over deprecated hp::DoFHandler. --- diff --git a/include/deal.II/distributed/error_predictor.h b/include/deal.II/distributed/error_predictor.h index 6858dcab6a..ad2ad9d855 100644 --- a/include/deal.II/distributed/error_predictor.h +++ b/include/deal.II/distributed/error_predictor.h @@ -30,6 +30,9 @@ DEAL_II_NAMESPACE_OPEN // forward declarations #ifndef DOXYGEN +template +class DoFHandler; + template class Vector; @@ -41,12 +44,6 @@ namespace parallel class Triangulation; } } // namespace parallel - -namespace hp -{ - template - class DoFHandler; -} #endif @@ -129,12 +126,12 @@ namespace parallel /** * Constructor. * - * @param[in] dof The hp::DoFHandler on which all operations will + * @param[in] dof The DoFHandler on which all operations will * happen. At the time when this constructor is called, the * DoFHandler still points to the triangulation before the * refinement in question happens. */ - ErrorPredictor(const hp::DoFHandler &dof); + ErrorPredictor(const DoFHandler &dof); /** * Prepare the current object for coarsening and refinement. @@ -191,7 +188,7 @@ namespace parallel /** * Pointer to the degree of freedom handler to work with. */ - SmartPointer, + SmartPointer, ErrorPredictor> dof_handler; diff --git a/include/deal.II/dofs/dof_accessor.h b/include/deal.II/dofs/dof_accessor.h index 75b130f0f9..ad0ce0b61b 100644 --- a/include/deal.II/dofs/dof_accessor.h +++ b/include/deal.II/dofs/dof_accessor.h @@ -736,8 +736,6 @@ private: // functions. template friend class DoFHandler; - template - friend class hp::DoFHandler; friend struct dealii::internal::DoFHandlerImplementation::Policy:: Implementation; @@ -1208,8 +1206,6 @@ protected: // functions. template friend class DoFHandler; - template - friend class hp::DoFHandler; friend struct dealii::internal::DoFHandlerImplementation::Policy:: Implementation; diff --git a/include/deal.II/dofs/dof_accessor.templates.h b/include/deal.II/dofs/dof_accessor.templates.h index 54a5023b9f..315152b8b8 100644 --- a/include/deal.II/dofs/dof_accessor.templates.h +++ b/include/deal.II/dofs/dof_accessor.templates.h @@ -88,9 +88,7 @@ inline DoFAccessor::DoFAccessor( Assert(false, ExcMessage( "You are trying to assign iterators that are incompatible. " - "Reasons for incompatibility are that they point to different " - "types of DoFHandlers (e.g., dealii::DoFHandler and " - "dealii::hp::DoFHandler) or that they refer to objects of " + "The reason for incompatibility is that they refer to objects of " "different dimensionality (e.g., assigning a line iterator " "to a quad iterator).")); } @@ -548,7 +546,7 @@ namespace internal { Assert(dof_handler.hp_capability_enabled == false, ExcMessage( - "hp::DoFHandler does not implement multilevel DoFs.")); + "DoFHandler in hp-mode does not implement multilevel DoFs.")); return dof_handler.mg_vertex_dofs[vertex_index].get_index( level, i, dof_handler.get_fe().n_dofs_per_vertex()); @@ -566,7 +564,7 @@ namespace internal { Assert(dof_handler.hp_capability_enabled == false, ExcMessage( - "hp::DoFHandler does not implement multilevel DoFs.")); + "DoFHandler in hp-mode does not implement multilevel DoFs.")); return dof_handler.mg_vertex_dofs[vertex_index].set_index( level, i, dof_handler.get_fe().n_dofs_per_vertex(), index); @@ -1563,7 +1561,8 @@ DoFAccessor::mg_vertex_dof_index( AssertIndexRange(i, this->dof_handler->get_fe(fe_index).n_dofs_per_vertex()); Assert(dof_handler->hp_capability_enabled == false, - ExcMessage("hp::DoFHandler does not implement multilevel DoFs.")); + ExcMessage( + "DoFHandler in hp-mode does not implement multilevel DoFs.")); return this->dof_handler->mg_vertex_dofs[this->vertex_index(vertex)] .get_index(level, i, this->dof_handler->get_fe().n_dofs_per_vertex()); @@ -1615,7 +1614,8 @@ DoFAccessor:: AssertIndexRange(i, this->dof_handler->get_fe(fe_index).n_dofs_per_vertex()); Assert(dof_handler->hp_capability_enabled == false, - ExcMessage("hp::DoFHandler does not implement multilevel DoFs.")); + ExcMessage( + "DoFHandler in hp-mode does not implement multilevel DoFs.")); this->dof_handler->mg_vertex_dofs[this->vertex_index(vertex)].set_index( level, i, this->dof_handler->get_fe().n_dofs_per_vertex(), index); @@ -2753,9 +2753,9 @@ DoFCellAccessor::get_fe() const Assert((this->dof_handler->hp_capability_enabled == false) || this->is_active(), ExcMessage( - "In hp::DoFHandler objects, finite elements are only associated " - "with active cells. Consequently, you can not ask for the " - "active finite element on cells with children.")); + "For DoFHandler objects in hp-mode, finite elements are only " + "associated with active cells. Consequently, you can not ask " + "for the active finite element on cells with children.")); return this->dof_handler->get_fe(active_fe_index()); } @@ -2820,9 +2820,9 @@ DoFCellAccessor::get_future_fe() Assert((this->dof_handler->hp_capability_enabled == false) || this->is_active(), ExcMessage( - "In hp::DoFHandler objects, finite elements are only associated " - "with active cells. Consequently, you can not ask for the " - "future finite element on cells with children.")); + "For DoFHandler objects in hp-mode, finite elements are only " + "associated with active cells. Consequently, you can not ask " + "for the future finite element on cells with children.")); return this->dof_handler->get_fe(future_fe_index()); } diff --git a/include/deal.II/grid/tria.h b/include/deal.II/grid/tria.h index 2a57871fe6..b4c8ff6092 100644 --- a/include/deal.II/grid/tria.h +++ b/include/deal.II/grid/tria.h @@ -4023,8 +4023,6 @@ private: friend struct dealii::internal::TriaAccessorImplementation::Implementation; - friend class hp::DoFHandler; - friend struct dealii::internal::TriangulationImplementation::Implementation; friend struct dealii::internal::TriangulationImplementation:: ImplementationMixedMesh; diff --git a/source/distributed/error_predictor.cc b/source/distributed/error_predictor.cc index 65d8bbba29..b854bd7307 100644 --- a/source/distributed/error_predictor.cc +++ b/source/distributed/error_predictor.cc @@ -22,13 +22,12 @@ # include # include +# include # include # include # include -# include - # include # include # include @@ -51,18 +50,18 @@ namespace parallel { template ErrorPredictor::ErrorPredictor( - const hp::DoFHandler &dof) + const DoFHandler &dof) : dof_handler(&dof, typeid(*this).name()) , handle(numbers::invalid_unsigned_int) , gamma_p(0.) , gamma_h(0.) , gamma_n(0.) { - Assert( - (dynamic_cast - *>(&dof_handler->get_triangulation()) != nullptr), - ExcMessage( - "parallel::distributed::ErrorPredictor requires a parallel::distributed::Triangulation object.")); + Assert((dynamic_cast< + const parallel::distributed::Triangulation *>( + &dof_handler->get_triangulation()) != nullptr), + ExcMessage("parallel::distributed::ErrorPredictor requires a " + "parallel::distributed::Triangulation object.")); } @@ -167,8 +166,8 @@ namespace parallel const typename Triangulation::cell_iterator &cell_, const typename Triangulation::CellStatus status) { - typename hp::DoFHandler::cell_iterator cell(*cell_, - dof_handler); + typename DoFHandler::cell_iterator cell(*cell_, + dof_handler); // create buffer for each individual input vector std::vector predicted_errors(error_indicators.size()); diff --git a/source/dofs/dof_accessor_get.cc b/source/dofs/dof_accessor_get.cc index 0569e0475e..baaefe657a 100644 --- a/source/dofs/dof_accessor_get.cc +++ b/source/dofs/dof_accessor_get.cc @@ -107,7 +107,7 @@ DoFCellAccessor::get_interpolated_dof_values( (fe_index != DoFHandler::invalid_fe_index), ExcMessage( "You cannot call this function on non-active cells " - "of hp::DoFHandler objects unless you provide an explicit " + "of DoFHandler objects unless you provide an explicit " "finite element index because they do not have naturally " "associated finite element spaces associated: degrees " "of freedom are only distributed on active cells for which " diff --git a/source/dofs/dof_accessor_set.cc b/source/dofs/dof_accessor_set.cc index b9fd3d0ab1..f4689c96a6 100644 --- a/source/dofs/dof_accessor_set.cc +++ b/source/dofs/dof_accessor_set.cc @@ -97,7 +97,7 @@ DoFCellAccessor::set_dof_values_by_interpolation( (fe_index != DoFHandler::invalid_fe_index), ExcMessage( "You cannot call this function on non-active cells " - "of hp::DoFHandler objects unless you provide an explicit " + "of DoFHandler objects unless you provide an explicit " "finite element index because they do not have naturally " "associated finite element spaces associated: degrees " "of freedom are only distributed on active cells for which " diff --git a/source/hp/refinement.cc b/source/hp/refinement.cc index dd976ef6ec..dbe8ae5485 100644 --- a/source/hp/refinement.cc +++ b/source/hp/refinement.cc @@ -543,8 +543,7 @@ namespace hp unsigned int parent_future_fe_index = numbers::invalid_unsigned_int; // store all determined future finite element indices on parent cells for // coarsening - std::map::cell_iterator, - unsigned int> + std::map::cell_iterator, unsigned int> future_fe_indices_on_coarsened_cells; // deep copy error indicators @@ -670,16 +669,17 @@ namespace hp if (dynamic_cast *>( &dof_handler.get_triangulation())) { - auto pack = []( - const typename dealii::hp::DoFHandler:: - active_cell_iterator &cell) -> std::pair { + auto pack = + [](const typename dealii::DoFHandler::active_cell_iterator + &cell) -> std::pair { return {cell->coarsen_flag_set(), cell->future_fe_index_set()}; }; - auto unpack = [&ghost_buffer]( - const typename dealii::hp::DoFHandler:: - active_cell_iterator & cell, - const std::pair pair) -> void { + auto unpack = + [&ghost_buffer](const typename dealii::DoFHandler:: + active_cell_iterator & cell, + const std::pair pair) -> void { ghost_buffer.emplace(cell->id(), pair); }; diff --git a/tests/hp/get_interpolated_dof_values_01.debug.output b/tests/hp/get_interpolated_dof_values_01.debug.output index 41ebc1842e..800f428388 100644 --- a/tests/hp/get_interpolated_dof_values_01.debug.output +++ b/tests/hp/get_interpolated_dof_values_01.debug.output @@ -1,13 +1,13 @@ DEAL::Yes, exception 1! -DEAL::ExcMessage ("In hp::DoFHandler objects, finite elements are only associated " "with active cells. Consequently, you can not ask for the " "active finite element on cells with children.") +DEAL::ExcMessage( "For DoFHandler objects in hp-mode, finite elements are only " "associated with active cells. Consequently, you can not ask " "for the active finite element on cells with children.") DEAL::Yes, exception 2! -DEAL::ExcMessage ("You cannot call this function on non-active cells " "of hp::DoFHandler objects unless you provide an explicit " "finite element index because they do not have naturally " "associated finite element spaces associated: degrees " "of freedom are only distributed on active cells for which " "the active_fe_index has been set.") +DEAL::ExcMessage( "You cannot call this function on non-active cells " "of DoFHandler objects unless you provide an explicit " "finite element index because they do not have naturally " "associated finite element spaces associated: degrees " "of freedom are only distributed on active cells for which " "the active_fe_index has been set.") DEAL::Yes, exception 1! -DEAL::ExcMessage ("In hp::DoFHandler objects, finite elements are only associated " "with active cells. Consequently, you can not ask for the " "active finite element on cells with children.") +DEAL::ExcMessage( "For DoFHandler objects in hp-mode, finite elements are only " "associated with active cells. Consequently, you can not ask " "for the active finite element on cells with children.") DEAL::Yes, exception 2! -DEAL::ExcMessage ("You cannot call this function on non-active cells " "of hp::DoFHandler objects unless you provide an explicit " "finite element index because they do not have naturally " "associated finite element spaces associated: degrees " "of freedom are only distributed on active cells for which " "the active_fe_index has been set.") +DEAL::ExcMessage( "You cannot call this function on non-active cells " "of DoFHandler objects unless you provide an explicit " "finite element index because they do not have naturally " "associated finite element spaces associated: degrees " "of freedom are only distributed on active cells for which " "the active_fe_index has been set.") DEAL::Yes, exception 1! -DEAL::ExcMessage ("In hp::DoFHandler objects, finite elements are only associated " "with active cells. Consequently, you can not ask for the " "active finite element on cells with children.") +DEAL::ExcMessage( "For DoFHandler objects in hp-mode, finite elements are only " "associated with active cells. Consequently, you can not ask " "for the active finite element on cells with children.") DEAL::Yes, exception 2! -DEAL::ExcMessage ("You cannot call this function on non-active cells " "of hp::DoFHandler objects unless you provide an explicit " "finite element index because they do not have naturally " "associated finite element spaces associated: degrees " "of freedom are only distributed on active cells for which " "the active_fe_index has been set.") +DEAL::ExcMessage( "You cannot call this function on non-active cells " "of DoFHandler objects unless you provide an explicit " "finite element index because they do not have naturally " "associated finite element spaces associated: degrees " "of freedom are only distributed on active cells for which " "the active_fe_index has been set.") diff --git a/tests/hp/set_dof_values_by_interpolation_01.debug.output b/tests/hp/set_dof_values_by_interpolation_01.debug.output index bf4d364d8c..a305d959e2 100644 --- a/tests/hp/set_dof_values_by_interpolation_01.debug.output +++ b/tests/hp/set_dof_values_by_interpolation_01.debug.output @@ -1,13 +1,13 @@ DEAL::Yes, exception 1! -DEAL::ExcMessage( "In hp::DoFHandler objects, finite elements are only associated " "with active cells. Consequently, you can not ask for the " "active finite element on cells with children.") +DEAL::ExcMessage( "For DoFHandler objects in hp-mode, finite elements are only " "associated with active cells. Consequently, you can not ask " "for the active finite element on cells with children.") DEAL::Yes, exception! -DEAL::ExcMessage( "You cannot call this function on non-active cells " "of hp::DoFHandler objects unless you provide an explicit " "finite element index because they do not have naturally " "associated finite element spaces associated: degrees " "of freedom are only distributed on active cells for which " "the active_fe_index has been set.") +DEAL::ExcMessage( "You cannot call this function on non-active cells " "of DoFHandler objects unless you provide an explicit " "finite element index because they do not have naturally " "associated finite element spaces associated: degrees " "of freedom are only distributed on active cells for which " "the active_fe_index has been set.") DEAL::Yes, exception 1! -DEAL::ExcMessage( "In hp::DoFHandler objects, finite elements are only associated " "with active cells. Consequently, you can not ask for the " "active finite element on cells with children.") +DEAL::ExcMessage( "For DoFHandler objects in hp-mode, finite elements are only " "associated with active cells. Consequently, you can not ask " "for the active finite element on cells with children.") DEAL::Yes, exception! -DEAL::ExcMessage( "You cannot call this function on non-active cells " "of hp::DoFHandler objects unless you provide an explicit " "finite element index because they do not have naturally " "associated finite element spaces associated: degrees " "of freedom are only distributed on active cells for which " "the active_fe_index has been set.") +DEAL::ExcMessage( "You cannot call this function on non-active cells " "of DoFHandler objects unless you provide an explicit " "finite element index because they do not have naturally " "associated finite element spaces associated: degrees " "of freedom are only distributed on active cells for which " "the active_fe_index has been set.") DEAL::Yes, exception 1! -DEAL::ExcMessage( "In hp::DoFHandler objects, finite elements are only associated " "with active cells. Consequently, you can not ask for the " "active finite element on cells with children.") +DEAL::ExcMessage( "For DoFHandler objects in hp-mode, finite elements are only " "associated with active cells. Consequently, you can not ask " "for the active finite element on cells with children.") DEAL::Yes, exception! -DEAL::ExcMessage( "You cannot call this function on non-active cells " "of hp::DoFHandler objects unless you provide an explicit " "finite element index because they do not have naturally " "associated finite element spaces associated: degrees " "of freedom are only distributed on active cells for which " "the active_fe_index has been set.") +DEAL::ExcMessage( "You cannot call this function on non-active cells " "of DoFHandler objects unless you provide an explicit " "finite element index because they do not have naturally " "associated finite element spaces associated: degrees " "of freedom are only distributed on active cells for which " "the active_fe_index has been set.")