From fbfb8ca5dd9e3a811d71ecb8846a7caa86aa6185 Mon Sep 17 00:00:00 2001 From: Marc Fehling Date: Fri, 26 Aug 2022 15:11:08 -0600 Subject: [PATCH] Adjust interface in 'dofs' folder to new datatype 'types::fe_index'. --- include/deal.II/dofs/dof_accessor.h | 97 +++++------ include/deal.II/dofs/dof_accessor.templates.h | 154 +++++++++--------- include/deal.II/dofs/dof_handler.h | 94 ++++++++--- include/deal.II/dofs/dof_objects.h | 8 +- include/deal.II/dofs/dof_tools.h | 6 +- .../mg_transfer_global_coarsening.templates.h | 12 +- source/dofs/dof_accessor.cc | 10 +- source/dofs/dof_accessor_get.cc | 8 +- source/dofs/dof_accessor_get.inst.in | 7 +- source/dofs/dof_accessor_set.cc | 8 +- source/dofs/dof_accessor_set.inst.in | 16 +- source/dofs/dof_handler.cc | 89 +++++----- source/dofs/dof_handler_policy.cc | 138 +++++++++------- source/dofs/dof_renumbering.cc | 8 +- source/dofs/dof_tools.cc | 10 +- source/dofs/dof_tools_constraints.cc | 37 +++-- source/dofs/dof_tools_sparsity.cc | 4 +- source/hp/fe_collection.cc | 8 +- tests/hp/crash_17.cc | 3 +- tests/hp/crash_18.cc | 3 +- tests/hp/fe_collection_05.cc | 12 +- tests/hp/fe_collection_05.output | 8 +- tests/hp/fe_collection_06.cc | 12 +- tests/hp/fe_collection_06.output | 8 +- tests/hp/get_active_fe_indices.cc | 2 +- tests/matrix_free/fe_nothing_01.cc | 4 +- .../mg_transfer_p_02.cc | 9 +- 27 files changed, 429 insertions(+), 346 deletions(-) diff --git a/include/deal.II/dofs/dof_accessor.h b/include/deal.II/dofs/dof_accessor.h index 9d4fb5307a..3df68c0adb 100644 --- a/include/deal.II/dofs/dof_accessor.h +++ b/include/deal.II/dofs/dof_accessor.h @@ -446,7 +446,7 @@ public: void get_dof_indices( std::vector &dof_indices, - const unsigned int fe_index = numbers::invalid_fe_index) const; + const types::fe_index fe_index = numbers::invalid_fe_index) const; /** * Return the global multilevel indices of the degrees of freedom that live @@ -458,15 +458,16 @@ public: get_mg_dof_indices( const int level, std::vector &dof_indices, - const unsigned int fe_index = numbers::invalid_fe_index) const; + const types::fe_index fe_index = numbers::invalid_fe_index) const; /** * Set the level DoF indices that are returned by get_mg_dof_indices. */ void - set_mg_dof_indices(const int level, - const std::vector &dof_indices, - const unsigned int fe_index = numbers::invalid_fe_index); + set_mg_dof_indices( + const int level, + const std::vector &dof_indices, + const types::fe_index fe_index = numbers::invalid_fe_index); /** * Global DoF index of the i degree associated with the @p vertexth @@ -491,9 +492,9 @@ public: */ types::global_dof_index vertex_dof_index( - const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index = numbers::invalid_fe_index) const; + const unsigned int vertex, + const unsigned int i, + const types::fe_index fe_index = numbers::invalid_fe_index) const; /** * Return the global DoF index of the ith degree of freedom @@ -502,10 +503,10 @@ public: */ types::global_dof_index mg_vertex_dof_index( - const int level, - const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index = numbers::invalid_fe_index) const; + const int level, + const unsigned int vertex, + const unsigned int i, + const types::fe_index fe_index = numbers::invalid_fe_index) const; /** * Index of the ith degree of freedom of this object. @@ -535,8 +536,8 @@ public: * the face. */ types::global_dof_index - dof_index(const unsigned int i, - const unsigned int fe_index = numbers::invalid_fe_index) const; + dof_index(const unsigned int i, + const types::fe_index fe_index = numbers::invalid_fe_index) const; /** * Return the dof_index on the given level. Also see dof_index. @@ -575,7 +576,7 @@ public: * n_active_fe_indices() active finite elements, and this function can be * queried for their indices. */ - unsigned int + types::fe_index nth_active_fe_index(const unsigned int n) const; /** @@ -584,7 +585,7 @@ public: * The size of the returned set equals the number of finite elements that * are active on this object. */ - std::set + std::set get_active_fe_indices() const; /** @@ -597,7 +598,7 @@ public: * n_active_fe_indices()). */ bool - fe_index_is_active(const unsigned int fe_index) const; + fe_index_is_active(const types::fe_index fe_index) const; /** * Return a reference to the finite element used on this object with the @@ -605,7 +606,7 @@ public: * fe_index_is_active(fe_index) must return true. */ const FiniteElement & - get_fe(const unsigned int fe_index) const; + get_fe(const types::fe_index fe_index) const; /** * @} @@ -711,9 +712,10 @@ protected: * active_fe_index(). */ void - set_dof_index(const unsigned int i, - const types::global_dof_index index, - const unsigned int fe_index = numbers::invalid_fe_index) const; + set_dof_index( + const unsigned int i, + const types::global_dof_index index, + const types::fe_index fe_index = numbers::invalid_fe_index) const; void set_mg_dof_index(const int level, @@ -726,7 +728,7 @@ protected: const unsigned int vertex, const unsigned int i, const types::global_dof_index index, - const unsigned int fe_index = numbers::invalid_fe_index) const; + const types::fe_index fe_index = numbers::invalid_fe_index) const; // Iterator classes need to be friends because they need to access // operator== and operator!=. @@ -994,7 +996,7 @@ public: void get_dof_indices( std::vector &dof_indices, - const unsigned int fe_index = AccessorData::invalid_fe_index) const; + const types::fe_index fe_index = numbers::invalid_fe_index) const; /** * Return the global multilevel indices of the degrees of freedom that live @@ -1006,7 +1008,7 @@ public: get_mg_dof_indices( const int level, std::vector &dof_indices, - const unsigned int fe_index = AccessorData::invalid_fe_index) const; + const types::fe_index fe_index = numbers::invalid_fe_index) const; /** * Global DoF index of the i degree associated with the @p vertexth @@ -1028,9 +1030,9 @@ public: */ types::global_dof_index vertex_dof_index( - const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index = AccessorData::invalid_fe_index) const; + const unsigned int vertex, + const unsigned int i, + const types::fe_index fe_index = numbers::invalid_fe_index) const; /** * Index of the ith degree of freedom of this object. @@ -1050,8 +1052,8 @@ public: * active_fe_index(). */ types::global_dof_index - dof_index(const unsigned int i, - const unsigned int fe_index = AccessorData::invalid_fe_index) const; + dof_index(const unsigned int i, + const types::fe_index fe_index = numbers::invalid_fe_index) const; /** * @} @@ -1081,7 +1083,7 @@ public: * calculated, this method just raises an exception and only exists to * enable dimension-independent programming. */ - unsigned int + types::fe_index nth_active_fe_index(const unsigned int n) const; /** @@ -1093,7 +1095,7 @@ public: * enable dimension-independent programming. */ bool - fe_index_is_active(const unsigned int fe_index) const; + fe_index_is_active(const types::fe_index fe_index) const; /** * Return a reference to the finite element used on this object with the @@ -1101,7 +1103,7 @@ public: * fe_index_is_active(fe_index) must return true. */ const FiniteElement<1, spacedim> & - get_fe(const unsigned int fe_index) const; + get_fe(const types::fe_index fe_index) const; /** * @} @@ -1198,7 +1200,7 @@ protected: set_dof_index( const unsigned int i, const types::global_dof_index index, - const unsigned int fe_index = AccessorData::invalid_fe_index) const; + const types::fe_index fe_index = numbers::invalid_fe_index) const; // Iterator classes need to be friends because they need to access // operator== and operator!=. @@ -1287,8 +1289,8 @@ public: * all other functions in this class this function only throws an exception. */ types::global_dof_index - dof_index(const unsigned int i, - const unsigned int fe_index = + dof_index(const unsigned int i, + const types::fe_index fe_index = DoFHandler::default_fe_index) const; /** @@ -1297,9 +1299,10 @@ public: * all other functions in this class this function only throws an exception. */ void - set_dof_index(const unsigned int i, - const types::global_dof_index index, - const unsigned int fe_index = numbers::invalid_fe_index) const; + set_dof_index( + const unsigned int i, + const types::global_dof_index index, + const types::fe_index fe_index = numbers::invalid_fe_index) const; }; @@ -1687,9 +1690,9 @@ public: template void get_interpolated_dof_values( - const InputVector &values, - Vector & interpolated_values, - const unsigned int fe_index = numbers::invalid_fe_index) const; + const InputVector & values, + Vector & interpolated_values, + const types::fe_index fe_index = numbers::invalid_fe_index) const; /** * This function is the counterpart to get_interpolated_dof_values(): you @@ -1757,7 +1760,7 @@ public: set_dof_values_by_interpolation( const Vector &local_values, OutputVector & values, - const unsigned int fe_index = numbers::invalid_fe_index, + const types::fe_index fe_index = numbers::invalid_fe_index, const bool perform_check = false) const; /** @@ -1774,7 +1777,7 @@ public: distribute_local_to_global_by_interpolation( const Vector &local_values, OutputVector & values, - const unsigned int fe_index = numbers::invalid_fe_index) const; + const types::fe_index fe_index = numbers::invalid_fe_index) const; /** * Distribute a local (cell based) vector to a global one by mapping the @@ -1979,7 +1982,7 @@ public: * this cell as a ghost cell. See the documentation of DoFHandler for more * information. */ - unsigned int + types::fe_index active_fe_index() const; /** @@ -2009,7 +2012,7 @@ public: * information. */ void - set_active_fe_index(const unsigned int i) const; + set_active_fe_index(const types::fe_index i) const; /** * @} */ @@ -2073,7 +2076,7 @@ public: * parallel::shared::Triangulation or parallel::distributed::Triangulation * classes, it is only allowed to call this function on locally owned cells. */ - unsigned int + types::fe_index future_fe_index() const; /** @@ -2085,7 +2088,7 @@ public: * functionality. */ void - set_future_fe_index(const unsigned int i) const; + set_future_fe_index(const types::fe_index i) const; /** * Return whether a future finite element has been set. diff --git a/include/deal.II/dofs/dof_accessor.templates.h b/include/deal.II/dofs/dof_accessor.templates.h index c062e3db65..f33d039e18 100644 --- a/include/deal.II/dofs/dof_accessor.templates.h +++ b/include/deal.II/dofs/dof_accessor.templates.h @@ -204,10 +204,10 @@ namespace internal * numbers::invalid_fe_index to a right value if needed/possible. */ template - unsigned int + types::fe_index get_fe_index_or_default( const DoFAccessor &cell, - const unsigned int fe_index) + const types::fe_index fe_index) { if (cell.get_dof_handler().has_hp_capabilities() == false) { @@ -279,7 +279,7 @@ namespace internal process_dof_index(const DoFHandler &dof_handler, const unsigned int obj_level, const unsigned int obj_index, - const unsigned int fe_index, + const types::fe_index fe_index, const unsigned int local_index, const std::integral_constant &, GlobalIndexType & global_index, @@ -339,7 +339,7 @@ namespace internal "You are requesting an active FE index that is not assigned " "to any of the cells connected to this entity.")); - const unsigned int fe_index_ = + const types::fe_index fe_index_ = std::distance(dof_handler.hp_object_fe_indices[structdim].begin() + dof_handler.hp_object_fe_ptr[structdim][obj_index], ptr); @@ -386,7 +386,7 @@ namespace internal process_object_range(const DoFHandler &dof_handler, const unsigned int obj_level, const unsigned int obj_index, - const unsigned int fe_index, + const types::fe_index fe_index, const std::integral_constant &) { Assert(structdim == dim || obj_level == 0, ExcNotImplemented()); @@ -439,7 +439,7 @@ namespace internal dof_handler.hp_object_fe_ptr[structdim][obj_index + 1], ExcNotImplemented()); - const unsigned int fe_index_local = + const types::fe_index fe_index_local = std::distance(dof_handler.hp_object_fe_indices[structdim].begin() + dof_handler.hp_object_fe_ptr[structdim][obj_index], fe_index_local_ptr); @@ -466,8 +466,8 @@ namespace internal static std::pair process_object_range( const dealii::DoFAccessor - accessor, - const unsigned int fe_index) + accessor, + const types::fe_index fe_index) { return process_object_range(accessor.get_dof_handler(), accessor.level(), @@ -505,7 +505,7 @@ namespace internal process_object(const DoFHandler & dof_handler, const unsigned int obj_level, const unsigned int obj_index, - const unsigned int fe_index, + const types::fe_index fe_index, const DoFMapping & mapping, const std::integral_constant &dd, types::global_dof_index *&dof_indices_ptr, @@ -545,7 +545,7 @@ namespace internal set_dof_index(const DoFHandler & dof_handler, const unsigned int obj_level, const unsigned int obj_index, - const unsigned int fe_index, + const types::fe_index fe_index, const unsigned int local_index, const std::integral_constant &dd, const types::global_dof_index global_index) @@ -576,7 +576,7 @@ namespace internal get_dof_index(const DoFHandler & dof_handler, const unsigned int obj_level, const unsigned int obj_index, - const unsigned int fe_index, + const types::fe_index fe_index, const unsigned int local_index, const std::integral_constant &dd) { @@ -659,7 +659,7 @@ namespace internal * get a DoF index on a vertex of the indicated cell. */ template - static unsigned int + static types::fe_index nth_active_fe_index(const DoFHandler &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -711,7 +711,7 @@ namespace internal * get a DoF index on a vertex of the indicated cell. */ template - static std::set + static std::set get_active_fe_indices(const DoFHandler &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -728,7 +728,7 @@ namespace internal return {dof_handler.hp_cell_active_fe_indices[obj_level][obj_index]}; // 3) general entity and hp is used - std::set active_fe_indices; + std::set active_fe_indices; for (unsigned int i = 0; i < n_active_fe_indices(dof_handler, obj_level, obj_index, t); ++i) @@ -744,7 +744,7 @@ namespace internal fe_index_is_active(const DoFHandler &dof_handler, const unsigned int obj_level, const unsigned int obj_index, - const unsigned int fe_index, + const types::fe_index fe_index, const std::integral_constant &) { Assert(structdim == dim || obj_level == 0, ExcNotImplemented()); @@ -868,9 +868,9 @@ namespace internal static unsigned int n_dof_indices( const dealii::DoFAccessor - & accessor, - const unsigned int fe_index_, - const bool count_level_dofs) + & accessor, + const types::fe_index fe_index_, + const bool count_level_dofs) { // note: we cannot rely on the template parameter level_dof_access here, // since the function get_mg_dof_indices()/set_mg_dof_indices() can be @@ -994,12 +994,12 @@ namespace internal const dealii::DoFAccessor & accessor, const DoFIndicesType &const_dof_indices, - const unsigned int fe_index_, + const types::fe_index fe_index_, const DoFOperation & dof_operation, const DoFProcessor & dof_processor, const bool count_level_dofs) { - const unsigned int fe_index = + const types::fe_index fe_index = internal::DoFAccessorImplementation::get_fe_index_or_default( accessor, fe_index_); @@ -1164,7 +1164,7 @@ namespace internal DEAL_II_ALWAYS_INLINE void process_vertex_dofs(DoFHandler &dof_handler, const unsigned int vertex_index, - const unsigned int fe_index, + const types::fe_index fe_index, types::global_dof_index *& dof_indices_ptr, const DoFProcessor & dof_processor) const { @@ -1190,7 +1190,7 @@ namespace internal process_dofs(const DoFHandler &dof_handler, const unsigned int obj_level, const unsigned int obj_index, - const unsigned int fe_index, + const types::fe_index fe_index, const DoFMapping & mapping, const std::integral_constant, types::global_dof_index *&dof_indices_ptr, @@ -1231,7 +1231,7 @@ namespace internal DEAL_II_ALWAYS_INLINE void process_vertex_dofs(DoFHandler &dof_handler, const unsigned int vertex_index, - const unsigned int, + const types::fe_index, types::global_dof_index *&dof_indices_ptr, const DoFProcessor & dof_processor) const { @@ -1252,9 +1252,9 @@ namespace internal DEAL_II_ALWAYS_INLINE void process_dofs(const DoFHandler &dof_handler, const unsigned int, - const unsigned int obj_index, - const unsigned int fe_index, - const DoFMapping & mapping, + const unsigned int obj_index, + const types::fe_index fe_index, + const DoFMapping & mapping, const std::integral_constant, types::global_dof_index *&dof_indices_ptr, const DoFProcessor & dof_processor) const @@ -1286,7 +1286,7 @@ namespace internal const dealii::DoFAccessor & accessor, std::vector &dof_indices, - const unsigned int fe_index) + const types::fe_index fe_index) { process_dof_indices( accessor, @@ -1305,7 +1305,7 @@ namespace internal const dealii::DoFAccessor & accessor, const std::vector &dof_indices, - const unsigned int fe_index) + const types::fe_index fe_index) { // Note: this function is as general as `get_dof_indices()`. This // assert is placed here since it is currently only used by the @@ -1336,7 +1336,7 @@ namespace internal & accessor, const int level, std::vector &dof_indices, - const unsigned int fe_index) + const types::fe_index fe_index) { Assert((fe_index == DoFHandler::default_fe_index), ExcMessage("MG DoF indices cannot be queried in hp case")); @@ -1358,7 +1358,7 @@ namespace internal & accessor, const int level, const std::vector &dof_indices, - const unsigned int fe_index) + const types::fe_index fe_index) { Assert((fe_index == DoFHandler::default_fe_index), ExcMessage("MG DoF indices cannot be queried in hp case")); @@ -1391,9 +1391,9 @@ namespace internal &mg_level, const std::unique_ptr> &, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, + const unsigned int obj_index, + const types::fe_index fe_index, + const unsigned int local_index, const std::integral_constant) { Assert(dof_handler.hp_capability_enabled == false, @@ -1415,10 +1415,10 @@ namespace internal const std::unique_ptr> &, const std::unique_ptr> - & mg_faces, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, + & mg_faces, + const unsigned int obj_index, + const types::fe_index fe_index, + const unsigned int local_index, const std::integral_constant) { return mg_faces->lines.access_dof_index( @@ -1437,10 +1437,10 @@ namespace internal const std::unique_ptr> &, const std::unique_ptr> - & mg_faces, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, + & mg_faces, + const unsigned int obj_index, + const types::fe_index fe_index, + const unsigned int local_index, const std::integral_constant) { Assert(dof_handler.hp_capability_enabled == false, @@ -1469,8 +1469,8 @@ namespace internal template inline types::global_dof_index DoFAccessor::dof_index( - const unsigned int i, - const unsigned int fe_index_) const + const unsigned int i, + const types::fe_index fe_index_) const { const auto fe_index = internal::DoFAccessorImplementation::get_fe_index_or_default(*this, @@ -1509,7 +1509,7 @@ inline void DoFAccessor::set_dof_index( const unsigned int i, const types::global_dof_index index, - const unsigned int fe_index_) const + const types::fe_index fe_index_) const { const auto fe_index = internal::DoFAccessorImplementation::get_fe_index_or_default(*this, @@ -1563,7 +1563,7 @@ DoFAccessor::n_active_fe_indices() template -inline unsigned int +inline types::fe_index DoFAccessor::nth_active_fe_index( const unsigned int n) const { @@ -1579,11 +1579,11 @@ DoFAccessor::nth_active_fe_index( template -inline std::set +inline std::set DoFAccessor::get_active_fe_indices() const { - std::set active_fe_indices; + std::set active_fe_indices; for (unsigned int i = 0; i < n_active_fe_indices(); ++i) active_fe_indices.insert(nth_active_fe_index(i)); return active_fe_indices; @@ -1594,7 +1594,7 @@ DoFAccessor::get_active_fe_indices() template inline bool DoFAccessor::fe_index_is_active( - const unsigned int fe_index) const + const types::fe_index fe_index) const { // access the respective DoF return dealii::internal::DoFAccessorImplementation::Implementation:: @@ -1610,11 +1610,11 @@ DoFAccessor::fe_index_is_active( template inline types::global_dof_index DoFAccessor::vertex_dof_index( - const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index_) const + const unsigned int vertex, + const unsigned int i, + const types::fe_index fe_index_) const { - const unsigned int fe_index = + const types::fe_index fe_index = (((this->dof_handler->hp_capability_enabled == false) && (fe_index_ == numbers::invalid_fe_index)) ? // No hp enabled, and the argument is at its default value -> we @@ -1642,10 +1642,10 @@ DoFAccessor::vertex_dof_index( template inline types::global_dof_index DoFAccessor::mg_vertex_dof_index( - const int level, - const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index_) const + const int level, + const unsigned int vertex, + const unsigned int i, + const types::fe_index fe_index_) const { const auto fe_index = internal::DoFAccessorImplementation::get_fe_index_or_default(*this, @@ -1675,7 +1675,7 @@ DoFAccessor:: const unsigned int vertex, const unsigned int i, const types::global_dof_index index, - const unsigned int fe_index_) const + const types::fe_index fe_index_) const { const auto fe_index = internal::DoFAccessorImplementation::get_fe_index_or_default(*this, @@ -1698,7 +1698,7 @@ DoFAccessor:: template inline const FiniteElement & DoFAccessor::get_fe( - const unsigned int fe_index) const + const types::fe_index fe_index) const { Assert(fe_index_is_active(fe_index) == true, ExcMessage("This function can only be called for active FE indices")); @@ -1871,7 +1871,7 @@ inline void DoFAccessor<0, 1, spacedim, level_dof_access>::set_dof_index( const unsigned int /*i*/, const types::global_dof_index /*index*/, - const unsigned int /*fe_index*/) const + const types::fe_index /*fe_index*/) const { Assert(false, ExcNotImplemented()); } @@ -1891,7 +1891,7 @@ template inline void DoFAccessor<0, 1, spacedim, level_dof_access>::get_dof_indices( std::vector &dof_indices, - const unsigned int fe_index_) const + const types::fe_index fe_index_) const { const auto fe_index = internal::DoFAccessorImplementation::get_fe_index_or_default(*this, @@ -1914,7 +1914,7 @@ inline void DoFAccessor<0, 1, spacedim, level_dof_access>::get_mg_dof_indices( const int level, std::vector &dof_indices, - const unsigned int fe_index_) const + const types::fe_index fe_index_) const { const auto fe_index = internal::DoFAccessorImplementation::get_fe_index_or_default(*this, @@ -1933,9 +1933,9 @@ DoFAccessor<0, 1, spacedim, level_dof_access>::get_mg_dof_indices( template inline types::global_dof_index DoFAccessor<0, 1, spacedim, level_dof_access>::vertex_dof_index( - const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index_) const + const unsigned int vertex, + const unsigned int i, + const types::fe_index fe_index_) const { const auto fe_index = internal::DoFAccessorImplementation::get_fe_index_or_default(*this, @@ -1957,8 +1957,8 @@ DoFAccessor<0, 1, spacedim, level_dof_access>::vertex_dof_index( template inline types::global_dof_index DoFAccessor<0, 1, spacedim, level_dof_access>::dof_index( - const unsigned int i, - const unsigned int fe_index_) const + const unsigned int i, + const types::fe_index fe_index_) const { const auto fe_index = internal::DoFAccessorImplementation::get_fe_index_or_default(*this, @@ -1989,7 +1989,7 @@ DoFAccessor<0, 1, spacedim, level_dof_access>::n_active_fe_indices() const template -inline unsigned int +inline types::fe_index DoFAccessor<0, 1, spacedim, level_dof_access>::nth_active_fe_index( const unsigned int /*n*/) const { @@ -2005,7 +2005,7 @@ DoFAccessor<0, 1, spacedim, level_dof_access>::nth_active_fe_index( template inline bool DoFAccessor<0, 1, spacedim, level_dof_access>::fe_index_is_active( - const unsigned int /*fe_index*/) const + const types::fe_index /*fe_index*/) const { Assert(false, ExcNotImplemented()); return false; @@ -2016,7 +2016,7 @@ DoFAccessor<0, 1, spacedim, level_dof_access>::fe_index_is_active( template inline const FiniteElement<1, spacedim> & DoFAccessor<0, 1, spacedim, level_dof_access>::get_fe( - const unsigned int fe_index) const + const types::fe_index fe_index) const { Assert(this->dof_handler != nullptr, ExcInvalidObject()); return dof_handler->get_fe(fe_index); @@ -2134,7 +2134,7 @@ namespace internal * do. */ template - static unsigned int + static types::fe_index active_fe_index( const DoFCellAccessor &accessor) { @@ -2163,7 +2163,7 @@ namespace internal static void set_active_fe_index( const DoFCellAccessor &accessor, - const unsigned int i) + const types::fe_index i) { if (accessor.dof_handler->hp_capability_enabled == false) { @@ -2193,7 +2193,7 @@ namespace internal * do. */ template - static unsigned int + static types::fe_index future_fe_index( const DoFCellAccessor &accessor) { @@ -2229,7 +2229,7 @@ namespace internal static void set_future_fe_index( const DoFCellAccessor &accessor, - const unsigned int i) + const types::fe_index i) { if (accessor.dof_handler->hp_capability_enabled == false) { @@ -2662,7 +2662,7 @@ DoFCellAccessor::get_fe() const template -inline unsigned int +inline types::fe_index DoFCellAccessor:: active_fe_index() const { @@ -2688,7 +2688,7 @@ DoFCellAccessor:: template inline void DoFCellAccessor:: - set_active_fe_index(const unsigned int i) const + set_active_fe_index(const types::fe_index i) const { Assert((this->dof_handler->hp_capability_enabled == false) || this->is_active(), @@ -2729,7 +2729,7 @@ DoFCellAccessor::get_future_fe() template -inline unsigned int +inline types::fe_index DoFCellAccessor:: future_fe_index() const { @@ -2754,7 +2754,7 @@ DoFCellAccessor:: template inline void DoFCellAccessor:: - set_future_fe_index(const unsigned int i) const + set_future_fe_index(const types::fe_index i) const { Assert((this->dof_handler->hp_capability_enabled == false) || (this->has_children() == false), diff --git a/include/deal.II/dofs/dof_handler.h b/include/deal.II/dofs/dof_handler.h index de792cb379..657aa8eeaa 100644 --- a/include/deal.II/dofs/dof_handler.h +++ b/include/deal.II/dofs/dof_handler.h @@ -515,7 +515,7 @@ public: /** * The default index of the finite element to be used on a given cell. */ - static const unsigned int default_fe_index = 0; + static const types::fe_index default_fe_index = 0; /** * Invalid index of the finite element to be used on a given cell. @@ -580,45 +580,85 @@ public: operator=(const DoFHandler &) = delete; /** - * Go through the triangulation and set the active FE indices of all - * locally owned cells to the values given in @p active_fe_indices. + * For each locally owned cell, set the active finite element index to the + * corresponding value given in @p active_fe_indices. Indices must be in the + * order how we iterate over active cells. + * + * Active FE indices will only be set for locally owned cells. Ghost and + * artificial cells will be ignored; no active FE index will be assigned to + * them. + * + * The vector @p active_fe_indices is assumed to have as many entries as + * there are active cells. + */ + void + set_active_fe_indices(const std::vector &active_fe_indices); + + /** + * @copydoc set_active_fe_indices() + * + * @deprecated Use set_active_fe_indices() with the types::fe_index datatype. */ + DEAL_II_DEPRECATED_EARLY void set_active_fe_indices(const std::vector &active_fe_indices); /** - * Go through the triangulation and return a vector of active FE indices of - * all locally relevant cells. Artificial cells will have the value - * numbers::invalid_fe_index assigned. + * For each locally relevant cell, extract the active finite element index and + * return them in the order how we iterate over active cells. + * + * As we do not know the active FE index on artificial cells, they are set to + * the invalid value numbers::invalid_fe_index. + * + * For DoFHandler objects without hp-capabilities, the vector will consist of + * zeros, indicating that all cells use the same finite element. In hp-mode, + * the values may be different, though. */ - std::vector + std::vector get_active_fe_indices() const; /** - * Go through the triangulation and store the active FE indices of all - * locally relevant cells to the vector @p active_fe_indices. This vector - * is resized, if necessary. + * For each locally relevant cell, extract the active finite element index and + * fill the vector @p active_fe_indices in the order how we iterate over + * active cells. This vector is resized, if necessary. + * + * As we do not know the active FE index on artificial cells, they are set to + * the invalid value numbers::invalid_fe_index. + * + * For DoFHandler objects without hp-capabilities, the vector will consist of + * zeros, indicating that all cells use the same finite element. In hp-mode, + * the values may be different, though. * - * @deprecated Use the function that returns the result vector. + * @deprecated Use get_active_fe_indices() that returns the result vector. */ DEAL_II_DEPRECATED_EARLY void get_active_fe_indices(std::vector &active_fe_indices) const; /** - * Go through the triangulation and set the future FE indices of all - * locally owned cells to the values given in @p future_fe_indices. - * Cells corresponding to numbers::invalid_fe_index will be skipped. + * For each locally owned cell, set the future finite element index to the + * corresponding value given in @p future_fe_indices. Indices must be in the + * order how we iterate over active cells. + * + * Future FE indices will only be set for locally owned cells. Ghost and + * artificial cells will be ignored; no future FE index will be assigned to + * them. + * + * The vector @p future_fe_indices is assumed to have as many entries as + * there are active cells. */ void - set_future_fe_indices(const std::vector &future_fe_indices); + set_future_fe_indices(const std::vector &future_fe_indices); /** - * Go through the triangulation and return a vector of future FE indices of - * all locally owned cells. If no future FE index has been set on a cell, - * its value will be numbers::invalid_fe_index. + * For each locally owned cell, extract the future finite element index and + * return them in the order how we iterate over active cells. + * + * As we do not know the future FE index on ghost and artificial cells, they + * are set to the invalid value numbers::invalid_fe_index. The same applies to + * locally owned cells that have no future FE index assigned. */ - std::vector + std::vector get_future_fe_indices() const; /** @@ -1173,7 +1213,7 @@ public: * used by this object. */ const FiniteElement & - get_fe(const unsigned int index = 0) const; + get_fe(const types::fe_index index = 0) const; /** * Return a constant reference to the set of finite element objects that @@ -1407,26 +1447,28 @@ private: * Container to temporarily store the iterator and future active FE index * of cells that persist. */ - std::map persisting_cells_fe_index; + std::map + persisting_cells_fe_index; /** * Container to temporarily store the iterator and future active FE index * of cells that will be refined. */ - std::map refined_cells_fe_index; + std::map refined_cells_fe_index; /** * Container to temporarily store the iterator and future active FE index * of parent cells that will remain after coarsening. */ - std::map coarsened_cells_fe_index; + std::map + coarsened_cells_fe_index; /** * Container to temporarily store the active FE index of every locally * owned cell for transfer across parallel::distributed::Triangulation * objects. */ - std::vector active_fe_indices; + std::vector active_fe_indices; /** * Helper object to transfer all active FE indices on @@ -1435,7 +1477,7 @@ private: */ std::unique_ptr< parallel::distributed:: - CellDataTransfer>> + CellDataTransfer>> cell_data_transfer; }; @@ -1843,7 +1885,7 @@ DoFHandler::locally_owned_mg_dofs(const unsigned int level) const template inline const FiniteElement & -DoFHandler::get_fe(const unsigned int number) const +DoFHandler::get_fe(const types::fe_index number) const { Assert(fe_collection.size() > 0, ExcMessage("No finite element collection is associated with " diff --git a/include/deal.II/dofs/dof_objects.h b/include/deal.II/dofs/dof_objects.h index c9c3444fdd..b8259b3a84 100644 --- a/include/deal.II/dofs/dof_objects.h +++ b/include/deal.II/dofs/dof_objects.h @@ -90,7 +90,7 @@ namespace internal types::global_dof_index & access_dof_index(const dealii::DoFHandler &dof_handler, const unsigned int obj_index, - const unsigned int fe_index, + const types::fe_index fe_index, const unsigned int local_index); /** @@ -113,7 +113,7 @@ namespace internal fe_index_is_active( const dealii::DoFHandler &dof_handler, const types::global_dof_index index, - const unsigned int fe_index) const; + const types::fe_index fe_index) const; /** * Determine an estimate for the memory consumption (in bytes) of this @@ -160,7 +160,7 @@ namespace internal DoFObjects::fe_index_is_active( const dealii::DoFHandler &, const types::global_dof_index, - const unsigned int fe_index) const + const types::fe_index fe_index) const { (void)fe_index; Assert((fe_index == @@ -178,7 +178,7 @@ namespace internal DoFObjects::access_dof_index( const dealii::DoFHandler &dof_handler, const unsigned int obj_index, - const unsigned int fe_index, + const types::fe_index fe_index, const unsigned int local_index) { (void)fe_index; diff --git a/include/deal.II/dofs/dof_tools.h b/include/deal.II/dofs/dof_tools.h index 7d9c983803..3b0616ed74 100644 --- a/include/deal.II/dofs/dof_tools.h +++ b/include/deal.II/dofs/dof_tools.h @@ -2134,7 +2134,11 @@ namespace DoFTools * returned vector will consist of only zeros, indicating that all cells use * the same finite element. In hp-mode, the values may be different, though. * - * @deprecated Use DoFHandler::get_active_fe_indices() instead. + * As we do not know the active FE index on artificial cells, we set them to + * the invalid value numbers::invalid_fe_index. + * + * @deprecated Use DoFHandler::get_active_fe_indices() that returns the result + * vector. */ template DEAL_II_DEPRECATED_EARLY void diff --git a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h index 71444b4e54..de4d426743 100644 --- a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h +++ b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h @@ -1264,17 +1264,21 @@ namespace internal loop_over_active_or_level_cells( dof_handler_fine, mg_level_fine, [&](const auto &cell) { min_active_fe_indices[0] = - std::min(min_active_fe_indices[0], cell->active_fe_index()); + std::min(min_active_fe_indices[0], + cell->active_fe_index()); max_active_fe_indices[0] = - std::max(max_active_fe_indices[0], cell->active_fe_index()); + std::max(max_active_fe_indices[0], + cell->active_fe_index()); }); loop_over_active_or_level_cells( dof_handler_coarse, mg_level_coarse, [&](const auto &cell) { min_active_fe_indices[1] = - std::min(min_active_fe_indices[1], cell->active_fe_index()); + std::min(min_active_fe_indices[1], + cell->active_fe_index()); max_active_fe_indices[1] = - std::max(max_active_fe_indices[1], cell->active_fe_index()); + std::max(max_active_fe_indices[1], + cell->active_fe_index()); }); const auto comm = dof_handler_fine.get_communicator(); diff --git a/source/dofs/dof_accessor.cc b/source/dofs/dof_accessor.cc index 4493aa851c..6c5d023cb6 100644 --- a/source/dofs/dof_accessor.cc +++ b/source/dofs/dof_accessor.cc @@ -77,7 +77,7 @@ template types::global_dof_index DoFInvalidAccessor::dof_index( const unsigned int, - const unsigned int) const + const types::fe_index) const { Assert(false, ExcInternalError()); return 0; @@ -90,7 +90,7 @@ void DoFInvalidAccessor::set_dof_index( const unsigned int, const types::global_dof_index, - const unsigned int) const + const types::fe_index) const { Assert(false, ExcInternalError()); } @@ -179,7 +179,7 @@ template inline void DoFAccessor::get_dof_indices( std::vector &dof_indices, - const unsigned int fe_index_) const + const types::fe_index fe_index_) const { Assert(this->dof_handler != nullptr, ExcInvalidObject()); @@ -217,7 +217,7 @@ inline void DoFAccessor::get_mg_dof_indices( const int level, std::vector &dof_indices, - const unsigned int fe_index_) const + const types::fe_index fe_index_) const { Assert(this->dof_handler != nullptr, ExcInvalidObject()); Assert(this->dof_handler->mg_vertex_dofs.size() > 0, @@ -239,7 +239,7 @@ inline void DoFAccessor::set_mg_dof_indices( const int level, const std::vector &dof_indices, - const unsigned int fe_index_) + const types::fe_index fe_index_) { Assert(this->dof_handler != nullptr, ExcInvalidObject()); diff --git a/source/dofs/dof_accessor_get.cc b/source/dofs/dof_accessor_get.cc index cd7861068f..529744bb3d 100644 --- a/source/dofs/dof_accessor_get.cc +++ b/source/dofs/dof_accessor_get.cc @@ -44,11 +44,11 @@ template template void DoFCellAccessor::get_interpolated_dof_values( - const InputVector &values, - Vector & interpolated_values, - const unsigned int fe_index_) const + const InputVector & values, + Vector & interpolated_values, + const types::fe_index fe_index_) const { - const unsigned int fe_index = + const types::fe_index fe_index = (this->dof_handler->hp_capability_enabled == false && fe_index_ == numbers::invalid_fe_index) ? DoFHandler::default_fe_index : diff --git a/source/dofs/dof_accessor_get.inst.in b/source/dofs/dof_accessor_get.inst.in index 341bb38d4f..f811bec057 100644 --- a/source/dofs/dof_accessor_get.inst.in +++ b/source/dofs/dof_accessor_get.inst.in @@ -20,7 +20,7 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS; lda : BOOL) template void DoFCellAccessor:: get_interpolated_dof_values(const VEC &, Vector &, - const unsigned int fe_index) const; + const types::fe_index) const; #if deal_II_dimension != 3 @@ -28,15 +28,14 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS; lda : BOOL) DoFCellAccessor:: get_interpolated_dof_values(const VEC &, Vector &, - const unsigned int fe_index) const; + const types::fe_index) const; #endif #if deal_II_dimension == 3 template void DoFCellAccessor<1, 3, lda>::get_interpolated_dof_values( - const VEC &, Vector &, const unsigned int fe_index) - const; + const VEC &, Vector &, const types::fe_index) const; #endif } diff --git a/source/dofs/dof_accessor_set.cc b/source/dofs/dof_accessor_set.cc index fa1b035969..d5396ae9e1 100644 --- a/source/dofs/dof_accessor_set.cc +++ b/source/dofs/dof_accessor_set.cc @@ -180,12 +180,12 @@ namespace internal const DoFCellAccessor & cell, const Vector & local_values, OutputVector & values, - const unsigned int fe_index_, + const types::fe_index fe_index_, const std::function &cell, const Vector &local_values, OutputVector & values)> &processor) { - const unsigned int fe_index = + const types::fe_index fe_index = (cell.get_dof_handler().has_hp_capabilities() == false && fe_index_ == numbers::invalid_fe_index) ? DoFHandler::default_fe_index : @@ -272,7 +272,7 @@ void DoFCellAccessor::set_dof_values_by_interpolation( const Vector &local_values, OutputVector & values, - const unsigned int fe_index_, + const types::fe_index fe_index_, const bool perform_check) const { internal::process_by_interpolation( @@ -295,7 +295,7 @@ DoFCellAccessor:: distribute_local_to_global_by_interpolation( const Vector &local_values, OutputVector & values, - const unsigned int fe_index_) const + const types::fe_index fe_index_) const { internal::process_by_interpolation( *this, diff --git a/source/dofs/dof_accessor_set.inst.in b/source/dofs/dof_accessor_set.inst.in index a3bfb93ba5..2274e1e315 100644 --- a/source/dofs/dof_accessor_set.inst.in +++ b/source/dofs/dof_accessor_set.inst.in @@ -20,12 +20,12 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS; lda : BOOL) template void DoFCellAccessor:: set_dof_values_by_interpolation(const Vector &, VEC &, - const unsigned int fe_index, + const types::fe_index, const bool) const; template void DoFCellAccessor:: distribute_local_to_global_by_interpolation( - const Vector &, VEC &, const unsigned int fe_index) + const Vector &, VEC &, const types::fe_index fe_index) const; #if deal_II_dimension != 3 @@ -34,13 +34,13 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS; lda : BOOL) DoFCellAccessor:: set_dof_values_by_interpolation(const Vector &, VEC &, - const unsigned int fe_index, + const types::fe_index, const bool) const; template void DoFCellAccessor:: distribute_local_to_global_by_interpolation( - const Vector &, VEC &, const unsigned int fe_index) + const Vector &, VEC &, const types::fe_index fe_index) const; #endif @@ -48,14 +48,12 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS; lda : BOOL) #if deal_II_dimension == 3 template void DoFCellAccessor<1, 3, lda>::set_dof_values_by_interpolation( - const Vector &, - VEC &, - const unsigned int fe_index, - const bool) const; + const Vector &, VEC &, const types::fe_index, const bool) + const; template void DoFCellAccessor<1, 3, lda>::distribute_local_to_global_by_interpolation( - const Vector &, VEC &, const unsigned int fe_index) + const Vector &, VEC &, const types::fe_index fe_index) const; #endif diff --git a/source/dofs/dof_handler.cc b/source/dofs/dof_handler.cc index 08cebf1e72..4eab815d31 100644 --- a/source/dofs/dof_handler.cc +++ b/source/dofs/dof_handler.cc @@ -43,7 +43,7 @@ DEAL_II_NAMESPACE_OPEN template -const unsigned int DoFHandler::default_fe_index; +const types::fe_index DoFHandler::default_fe_index; namespace internal @@ -977,8 +977,8 @@ namespace internal (cell->active_fe_index() == cell->neighbor(face)->active_fe_index()))) { - const unsigned int fe = cell->active_fe_index(); - const unsigned int n_dofs = + const types::fe_index fe = cell->active_fe_index(); + const unsigned int n_dofs = dof_handler.get_fe(fe) .template n_dofs_per_object(face); const unsigned int offset = @@ -994,9 +994,9 @@ namespace internal } else { - unsigned int fe_1 = cell->active_fe_index(); - unsigned int face_no_1 = face; - unsigned int fe_2 = + types::fe_index fe_1 = cell->active_fe_index(); + unsigned int face_no_1 = face; + types::fe_index fe_2 = cell->neighbor(face)->active_fe_index(); unsigned int face_no_2 = cell->neighbor_face_no(face); @@ -1509,7 +1509,7 @@ namespace internal dim>::ExcInconsistentCoarseningFlags()); #endif - const unsigned int fe_index = dealii::internal::hp:: + const types::fe_index fe_index = dealii::internal::hp:: DoFHandlerImplementation::Implementation:: dominated_future_fe_on_children( parent); @@ -1595,23 +1595,24 @@ namespace internal * one dominated by all children for the parent cell. */ template - static unsigned int + static types::fe_index determine_fe_from_children( const typename Triangulation::cell_iterator &, - const std::vector & children_fe_indices, + const std::vector & children_fe_indices, const dealii::hp::FECollection &fe_collection) { Assert(!children_fe_indices.empty(), ExcInternalError()); // convert vector to set + // TODO: Change set to types::fe_index const std::set children_fe_indices_set( children_fe_indices.begin(), children_fe_indices.end()); - const unsigned int dominated_fe_index = + const types::fe_index dominated_fe_index = fe_collection.find_dominated_fe_extended(children_fe_indices_set, /*codim=*/0); - Assert(dominated_fe_index != numbers::invalid_unsigned_int, + Assert(dominated_fe_index != numbers::invalid_fe_index, ExcNoDominatedFiniteElementOnChildren()); return dominated_fe_index; @@ -1626,7 +1627,7 @@ namespace internal * See documentation in the header file for more information. */ template - static unsigned int + static types::fe_index dominated_future_fe_on_children( const typename DoFHandler::cell_iterator &parent) { @@ -1641,6 +1642,7 @@ namespace internal dof_handler.has_hp_capabilities(), (typename DoFHandler::ExcOnlyAvailableWithHP())); + // TODO: Change set to types::fe_index std::set future_fe_indices_children; for (const auto &child : parent->child_iterators()) { @@ -1656,7 +1658,7 @@ namespace internal // here and thus call the internal function that does not check // for cell ownership. This requires that future FE indices have // been communicated prior to calling this function. - const unsigned int future_fe_index_child = + const types::fe_index future_fe_index_child = dealii::internal::DoFCellAccessorImplementation:: Implementation::future_fe_index(*child); @@ -1664,12 +1666,12 @@ namespace internal } Assert(!future_fe_indices_children.empty(), ExcInternalError()); - const unsigned int future_fe_index = + const types::fe_index future_fe_index = dof_handler.fe_collection.find_dominated_fe_extended( future_fe_indices_children, /*codim=*/0); - Assert(future_fe_index != numbers::invalid_unsigned_int, + Assert(future_fe_index != numbers::invalid_fe_index, ExcNoDominatedFiniteElementOnChildren()); return future_fe_index; @@ -2564,7 +2566,7 @@ DoFHandler::max_couplings_between_dofs() const template void DoFHandler::set_active_fe_indices( - const std::vector &active_fe_indices) + const std::vector &active_fe_indices) { Assert(active_fe_indices.size() == this->get_triangulation().n_active_cells(), ExcDimensionMismatch(active_fe_indices.size(), @@ -2583,10 +2585,21 @@ DoFHandler::set_active_fe_indices( template -std::vector +void +DoFHandler::set_active_fe_indices( + const std::vector &active_fe_indices) +{ + set_active_fe_indices(std::vector(active_fe_indices.begin(), + active_fe_indices.end())); +} + + + +template +std::vector DoFHandler::get_active_fe_indices() const { - std::vector active_fe_indices( + std::vector active_fe_indices( this->get_triangulation().n_active_cells(), numbers::invalid_fe_index); // we could try to extract the values directly, since they are @@ -2606,7 +2619,9 @@ void DoFHandler::get_active_fe_indices( std::vector &active_fe_indices) const { - active_fe_indices = get_active_fe_indices(); + std::vector indices = get_active_fe_indices(); + + active_fe_indices.assign(indices.begin(), indices.end()); } @@ -2614,7 +2629,7 @@ DoFHandler::get_active_fe_indices( template void DoFHandler::set_future_fe_indices( - const std::vector &future_fe_indices) + const std::vector &future_fe_indices) { Assert(future_fe_indices.size() == this->get_triangulation().n_active_cells(), ExcDimensionMismatch(future_fe_indices.size(), @@ -2635,10 +2650,10 @@ DoFHandler::set_future_fe_indices( template -std::vector +std::vector DoFHandler::get_future_fe_indices() const { - std::vector future_fe_indices( + std::vector future_fe_indices( this->get_triangulation().n_active_cells(), numbers::invalid_fe_index); // we could try to extract the values directly, since they are @@ -2877,7 +2892,7 @@ DoFHandler::pre_distributed_transfer_action() // Gather all current future FE indices. active_fe_index_transfer->active_fe_indices.resize( - get_triangulation().n_active_cells(), numbers::invalid_unsigned_int); + get_triangulation().n_active_cells(), numbers::invalid_fe_index); for (const auto &cell : active_cell_iterators()) if (cell->is_locally_owned()) @@ -2891,16 +2906,16 @@ DoFHandler::pre_distributed_transfer_action() active_fe_index_transfer->cell_data_transfer = std::make_unique< parallel::distributed:: - CellDataTransfer>>( + CellDataTransfer>>( *distributed_tria, /*transfer_variable_size_data=*/false, /*refinement_strategy=*/ &dealii::AdaptationStrategies::Refinement:: - preserve, + preserve, /*coarsening_strategy=*/ [this](const typename Triangulation::cell_iterator &parent, - const std::vector &children_fe_indices) - -> unsigned int { + const std::vector &children_fe_indices) + -> types::fe_index { return dealii::internal::hp::DoFHandlerImplementation::Implementation:: determine_fe_from_children(parent, children_fe_indices, @@ -2951,7 +2966,7 @@ DoFHandler::post_distributed_transfer_action() // Unpack active FE indices. this->active_fe_index_transfer->active_fe_indices.resize( - this->get_triangulation().n_active_cells(), numbers::invalid_unsigned_int); + this->get_triangulation().n_active_cells(), numbers::invalid_fe_index); this->active_fe_index_transfer->cell_data_transfer->unpack( this->active_fe_index_transfer->active_fe_indices); @@ -2998,16 +3013,16 @@ DoFHandler::prepare_for_serialization_of_active_fe_indices() active_fe_index_transfer->cell_data_transfer = std::make_unique< parallel::distributed:: - CellDataTransfer>>( + CellDataTransfer>>( *distributed_tria, /*transfer_variable_size_data=*/false, /*refinement_strategy=*/ &dealii::AdaptationStrategies::Refinement:: - preserve, + preserve, /*coarsening_strategy=*/ [this](const typename Triangulation::cell_iterator &parent, - const std::vector &children_fe_indices) - -> unsigned int { + const std::vector &children_fe_indices) + -> types::fe_index { return dealii::internal::hp::DoFHandlerImplementation::Implementation:: determine_fe_from_children(parent, children_fe_indices, @@ -3056,16 +3071,16 @@ DoFHandler::deserialize_active_fe_indices() active_fe_index_transfer->cell_data_transfer = std::make_unique< parallel::distributed:: - CellDataTransfer>>( + CellDataTransfer>>( *distributed_tria, /*transfer_variable_size_data=*/false, /*refinement_strategy=*/ &dealii::AdaptationStrategies::Refinement:: - preserve, + preserve, /*coarsening_strategy=*/ [this](const typename Triangulation::cell_iterator &parent, - const std::vector &children_fe_indices) - -> unsigned int { + const std::vector &children_fe_indices) + -> types::fe_index { return dealii::internal::hp::DoFHandlerImplementation::Implementation:: determine_fe_from_children(parent, children_fe_indices, @@ -3074,7 +3089,7 @@ DoFHandler::deserialize_active_fe_indices() // Unpack active FE indices. active_fe_index_transfer->active_fe_indices.resize( - get_triangulation().n_active_cells(), numbers::invalid_unsigned_int); + get_triangulation().n_active_cells(), numbers::invalid_fe_index); active_fe_index_transfer->cell_data_transfer->deserialize( active_fe_index_transfer->active_fe_indices); diff --git a/source/dofs/dof_handler_policy.cc b/source/dofs/dof_handler_policy.cc index cd5060bc17..cfe4200b21 100644 --- a/source/dofs/dof_handler_policy.cc +++ b/source/dofs/dof_handler_policy.cc @@ -85,8 +85,8 @@ namespace internal const std::unique_ptr & ensure_existence_and_return_dof_identities( const dealii::hp::FECollection &fes, - const unsigned int fe_index_1, - const unsigned int fe_index_2, + const types::fe_index fe_index_1, + const types::fe_index fe_index_2, std::unique_ptr & identities, const unsigned int face_no = numbers::invalid_unsigned_int) { @@ -97,6 +97,8 @@ namespace internal // exists if (identities.get() == nullptr) { + // TODO: Change to + // std::vector> std::vector> complete_identities; @@ -104,23 +106,26 @@ namespace internal { case 0: { - complete_identities = - fes.hp_vertex_dof_identities({fe_index_1, fe_index_2}); + // TODO: Change set to types::fe_index + complete_identities = fes.hp_vertex_dof_identities( + std::set{fe_index_1, fe_index_2}); break; } case 1: { - complete_identities = - fes.hp_line_dof_identities({fe_index_1, fe_index_2}); + // TODO: Change set to types::fe_index + complete_identities = fes.hp_line_dof_identities( + std::set{fe_index_1, fe_index_2}); break; } case 2: { - complete_identities = - fes.hp_quad_dof_identities({fe_index_1, fe_index_2}, - face_no); + // TODO: Change set to types::fe_index + complete_identities = fes.hp_quad_dof_identities( + std::set{fe_index_1, fe_index_2}, + face_no); break; } @@ -238,7 +243,7 @@ namespace internal if (n_active_fe_indices > 1) { - const std::set fe_indices = + const std::set fe_indices = dealii::internal::DoFAccessorImplementation:: Implementation::get_active_fe_indices( dof_handler, @@ -248,15 +253,16 @@ namespace internal // find out which is the most dominating finite // element of the ones that are used on this vertex - unsigned int most_dominating_fe_index = + // TODO: Change set to types::fe_index + types::fe_index most_dominating_fe_index = dof_handler.get_fe_collection().find_dominating_fe( - fe_indices, + {fe_indices.begin(), fe_indices.end()}, /*codim*/ dim); // if we haven't found a dominating finite element, // choose the very first one to be dominant - if (most_dominating_fe_index == - numbers::invalid_unsigned_int) + // TODO: Change assert to numbers::invalid_fe_index + if (most_dominating_fe_index == numbers::invalid_fe_index) most_dominating_fe_index = dealii::internal::DoFAccessorImplementation:: Implementation::nth_active_fe_index( @@ -426,10 +432,10 @@ namespace internal for (unsigned int f = 0; f < n_active_fe_indices; ++f) for (unsigned int g = f + 1; g < n_active_fe_indices; ++g) { - const unsigned int fe_index_1 = - line->nth_active_fe_index(f), - fe_index_2 = - line->nth_active_fe_index(g); + const types::fe_index fe_index_1 = + line->nth_active_fe_index(f), + fe_index_2 = + line->nth_active_fe_index(g); // as described in the hp-paper, we only unify on lines // when there are at most two different FE objects @@ -488,18 +494,20 @@ namespace internal // determine which one of both finite // elements is the dominating one. - const std::set fe_indices{ + const std::set fe_indices{ fe_index_1, fe_index_2}; - unsigned int dominating_fe_index = + // TODO: Change set to types::fe_index + types::fe_index dominating_fe_index = dof_handler.get_fe_collection() - .find_dominating_fe(fe_indices, + .find_dominating_fe({fe_indices.begin(), + fe_indices.end()}, /*codim=*/dim - 1); - unsigned int other_fe_index = - numbers::invalid_unsigned_int; + types::fe_index other_fe_index = + numbers::invalid_fe_index; if (dominating_fe_index != - numbers::invalid_unsigned_int) + numbers::invalid_fe_index) other_fe_index = (dominating_fe_index == fe_index_1) ? fe_index_2 : @@ -621,14 +629,15 @@ namespace internal // is not what we describe in the paper!. if ((unique_sets_of_dofs == 2) && (dim == 2)) { - const std::set fe_indices = + const std::set fe_indices = line->get_active_fe_indices(); // find out which is the most dominating finite element of // the ones that are used on this line - const unsigned int most_dominating_fe_index = + // TODO: Change set to types::fe_index + const types::fe_index most_dominating_fe_index = dof_handler.get_fe_collection().find_dominating_fe( - fe_indices, + {fe_indices.begin(), fe_indices.end()}, /*codim=*/dim - 1); // if we found the most dominating element, then use this @@ -636,8 +645,7 @@ namespace internal // identification. otherwise, the code that computes // hanging node constraints will have to deal with it by // computing appropriate constraints along this face/edge - if (most_dominating_fe_index != - numbers::invalid_unsigned_int) + if (most_dominating_fe_index != numbers::invalid_fe_index) { // loop over the indices of all the finite elements // that are not dominating, and identify their dofs to @@ -773,14 +781,15 @@ namespace internal const auto quad = cell->quad(q); quad_touched[quad->index()] = true; - const std::set fe_indices = + const std::set fe_indices = quad->get_active_fe_indices(); // find out which is the most dominating finite // element of the ones that are used on this quad - const unsigned int most_dominating_fe_index = + // TODO: Change set to types::fe_index + const types::fe_index most_dominating_fe_index = dof_handler.get_fe_collection().find_dominating_fe( - fe_indices, + {fe_indices.begin(), fe_indices.end()}, /*codim=*/dim - 2); const unsigned int most_dominating_fe_index_face_no = @@ -794,7 +803,7 @@ namespace internal // computes hanging node constraints will have to // deal with it by computing appropriate constraints // along this face/edge - if (most_dominating_fe_index != numbers::invalid_unsigned_int) + if (most_dominating_fe_index != numbers::invalid_fe_index) { // loop over the indices of all the finite // elements that are not dominating, and @@ -1070,7 +1079,7 @@ namespace internal if (n_active_fe_indices > 1) { - const std::set fe_indices = + const std::set fe_indices = dealii::internal::DoFAccessorImplementation:: Implementation::get_active_fe_indices( dof_handler, @@ -1080,16 +1089,16 @@ namespace internal // find out which is the most dominating finite // element of the ones that are used on this vertex - unsigned int most_dominating_fe_index = + // TODO: Change set to types::fe_index + types::fe_index most_dominating_fe_index = dof_handler.get_fe_collection().find_dominating_fe( - fe_indices, + {fe_indices.begin(), fe_indices.end()}, /*codim=*/dim); // if we haven't found a dominating finite element, // choose the very first one to be dominant similar // to compute_vertex_dof_identities() - if (most_dominating_fe_index == - numbers::invalid_unsigned_int) + if (most_dominating_fe_index == numbers::invalid_fe_index) most_dominating_fe_index = dealii::internal::DoFAccessorImplementation:: Implementation::nth_active_fe_index( @@ -1251,10 +1260,10 @@ namespace internal for (unsigned int f = 0; f < n_active_fe_indices; ++f) for (unsigned int g = f + 1; g < n_active_fe_indices; ++g) { - const unsigned int fe_index_1 = - line->nth_active_fe_index(f), - fe_index_2 = - line->nth_active_fe_index(g); + const types::fe_index fe_index_1 = + line->nth_active_fe_index(f), + fe_index_2 = + line->nth_active_fe_index(g); if ((dof_handler.get_fe(fe_index_1).n_dofs_per_line() == dof_handler.get_fe(fe_index_2) @@ -1297,18 +1306,20 @@ namespace internal // determine which one of both finite // elements is the dominating one. - const std::set fe_indices{ + const std::set fe_indices{ fe_index_1, fe_index_2}; - unsigned int dominating_fe_index = + // TODO: Change set to types::fe_index + types::fe_index dominating_fe_index = dof_handler.get_fe_collection() - .find_dominating_fe(fe_indices, + .find_dominating_fe({fe_indices.begin(), + fe_indices.end()}, /*codim*/ dim - 1); - unsigned int other_fe_index = - numbers::invalid_unsigned_int; + types::fe_index other_fe_index = + numbers::invalid_fe_index; if (dominating_fe_index != - numbers::invalid_unsigned_int) + numbers::invalid_fe_index) other_fe_index = (dominating_fe_index == fe_index_1) ? fe_index_2 : @@ -1370,14 +1381,15 @@ namespace internal // is not what we describe in the paper!. if ((unique_sets_of_dofs == 2) && (dim == 2)) { - const std::set fe_indices = + const std::set fe_indices = line->get_active_fe_indices(); // find out which is the most dominating finite element of // the ones that are used on this line - const unsigned int most_dominating_fe_index = + // TODO: Change set to types::fe_index + const types::fe_index most_dominating_fe_index = dof_handler.get_fe_collection().find_dominating_fe( - fe_indices, + {fe_indices.begin(), fe_indices.end()}, /*codim=*/dim - 1); // if we found the most dominating element, then use this @@ -1385,8 +1397,7 @@ namespace internal // identification. otherwise, the code that computes // hanging node constraints will have to deal with it by // computing appropriate constraints along this face/edge - if (most_dominating_fe_index != - numbers::invalid_unsigned_int) + if (most_dominating_fe_index != numbers::invalid_fe_index) { // loop over the indices of all the finite elements // that are not dominating, and identify their dofs to @@ -1506,17 +1517,18 @@ namespace internal const auto quad = cell->quad(q); quad_marked[quad->index()] = false; - const std::set fe_indices = + const std::set fe_indices = quad->get_active_fe_indices(); // find out which is the most dominating finite // element of the ones that are used on this quad - const unsigned int most_dominating_fe_index = + // TODO: Change set to types::fe_index + const types::fe_index most_dominating_fe_index = dof_handler.get_fe_collection().find_dominating_fe( - fe_indices, + {fe_indices.begin(), fe_indices.end()}, /*codim=*/dim - 2); - const unsigned int most_dominating_fe_index_face_no = + const types::fe_index most_dominating_fe_index_face_no = cell->active_fe_index() == most_dominating_fe_index ? q : cell->neighbor_face_no(q); @@ -1527,7 +1539,7 @@ namespace internal // computes hanging node constraints will have to // deal with it by computing appropriate constraints // along this face/edge - if (most_dominating_fe_index != numbers::invalid_unsigned_int) + if (most_dominating_fe_index != numbers::invalid_fe_index) { // loop over the indices of all the finite // elements that are not dominating, and @@ -1875,7 +1887,7 @@ namespace internal // us to do for (unsigned int f = 0; f < n_active_fe_indices; ++f) { - const unsigned int fe_index = + const types::fe_index fe_index = dealii::internal::DoFAccessorImplementation:: Implementation::nth_active_fe_index( dof_handler, @@ -1995,7 +2007,7 @@ namespace internal for (const auto &cell : dof_handler.active_cell_iterators()) if (!cell->is_artificial()) { - const unsigned int fe_index = cell->active_fe_index(); + const types::fe_index fe_index = cell->active_fe_index(); for (unsigned int d = 0; d < dof_handler.get_fe(fe_index) @@ -2095,7 +2107,7 @@ namespace internal for (unsigned int f = 0; f < n_active_fe_indices; ++f) { - const unsigned int fe_index = + const types::fe_index fe_index = line->nth_active_fe_index(f); for (unsigned int d = 0; @@ -2190,7 +2202,7 @@ namespace internal for (unsigned int f = 0; f < n_active_fe_indices; ++f) { - const unsigned int fe_index = + const types::fe_index fe_index = line->nth_active_fe_index(f); for (unsigned int d = 0; @@ -2256,7 +2268,7 @@ namespace internal for (unsigned int f = 0; f < n_active_fe_indices; ++f) { - const unsigned int fe_index = + const types::fe_index fe_index = quad->nth_active_fe_index(f); for (unsigned int d = 0; diff --git a/source/dofs/dof_renumbering.cc b/source/dofs/dof_renumbering.cc index 57fcf93ca0..3486224312 100644 --- a/source/dofs/dof_renumbering.cc +++ b/source/dofs/dof_renumbering.cc @@ -873,8 +873,8 @@ namespace DoFRenumbering // on each cell: get dof indices // and insert them into the global // list using their component - const unsigned int fe_index = cell->active_fe_index(); - const unsigned int dofs_per_cell = + const types::fe_index fe_index = cell->active_fe_index(); + const unsigned int dofs_per_cell = fe_collection[fe_index].n_dofs_per_cell(); local_dof_indices.resize(dofs_per_cell); cell->get_active_or_mg_dof_indices(local_dof_indices); @@ -1146,8 +1146,8 @@ namespace DoFRenumbering // on each cell: get dof indices // and insert them into the global // list using their component - const unsigned int fe_index = cell->active_fe_index(); - const unsigned int dofs_per_cell = + const types::fe_index fe_index = cell->active_fe_index(); + const unsigned int dofs_per_cell = fe_collection[fe_index].n_dofs_per_cell(); local_dof_indices.resize(dofs_per_cell); cell->get_active_or_mg_dof_indices(local_dof_indices); diff --git a/source/dofs/dof_tools.cc b/source/dofs/dof_tools.cc index 3d4be7b78a..4bf32a5bb8 100644 --- a/source/dofs/dof_tools.cc +++ b/source/dofs/dof_tools.cc @@ -222,8 +222,8 @@ namespace DoFTools for (const auto &c : dof.active_cell_iterators() | IteratorFilters::LocallyOwnedCell()) { - const unsigned int fe_index = c->active_fe_index(); - const unsigned int dofs_per_cell = c->get_fe().n_dofs_per_cell(); + const types::fe_index fe_index = c->active_fe_index(); + const unsigned int dofs_per_cell = c->get_fe().n_dofs_per_cell(); indices.resize(dofs_per_cell); c->get_dof_indices(indices); for (unsigned int i = 0; i < dofs_per_cell; ++i) @@ -282,7 +282,7 @@ namespace DoFTools for (const auto &cell : dof.active_cell_iterators()) if (cell->is_locally_owned()) { - const unsigned int fe_index = cell->active_fe_index(); + const types::fe_index fe_index = cell->active_fe_index(); const unsigned int dofs_per_cell = cell->get_fe().n_dofs_per_cell(); indices.resize(dofs_per_cell); cell->get_dof_indices(indices); @@ -1369,7 +1369,9 @@ namespace DoFTools AssertDimension(active_fe_indices.size(), dof_handler.get_triangulation().n_active_cells()); - active_fe_indices = dof_handler.get_active_fe_indices(); + std::vector indices = dof_handler.get_active_fe_indices(); + + active_fe_indices.assign(indices.begin(), indices.end()); } template diff --git a/source/dofs/dof_tools_constraints.cc b/source/dofs/dof_tools_constraints.cc index 00e35675a7..7f73278f1d 100644 --- a/source/dofs/dof_tools_constraints.cc +++ b/source/dofs/dof_tools_constraints.cc @@ -695,7 +695,7 @@ namespace DoFTools // ok, start up the work const FiniteElement &fe = cell->get_fe(); - const unsigned int fe_index = cell->active_fe_index(); + const types::fe_index fe_index = cell->active_fe_index(); const unsigned int n_dofs_on_mother = 2 * fe.n_dofs_per_vertex() + @@ -881,7 +881,7 @@ namespace DoFTools // ok, start up the work const FiniteElement &fe = cell->get_fe(); - const unsigned int fe_index = cell->active_fe_index(); + const types::fe_index fe_index = cell->active_fe_index(); const unsigned int n_dofs_on_mother = fe.n_dofs_per_face(face); const unsigned int n_dofs_on_children = @@ -1135,7 +1135,7 @@ namespace DoFTools // auxiliary variable which holds FE indices of the mother face // and its subfaces. This knowledge will be needed in hp-case // with neither_element_dominates. - std::set fe_ind_face_subface; + std::set fe_ind_face_subface; fe_ind_face_subface.insert(cell->active_fe_index()); if (dof_handler.has_hp_capabilities()) @@ -1193,7 +1193,7 @@ namespace DoFTools Assert(subface->n_active_fe_indices() == 1, ExcInternalError()); - const unsigned int subface_fe_index = + const types::fe_index subface_fe_index = subface->nth_active_fe_index(0); // we sometime run into the situation where for @@ -1310,12 +1310,15 @@ namespace DoFTools // Note that the last solution covers the first two // scenarios, thus we stick with it assuming that we // won't lose much time/efficiency. - const unsigned int dominating_fe_index = + // TODO: Change set to types::fe_index + const types::fe_index dominating_fe_index = fe_collection.find_dominating_fe_extended( - fe_ind_face_subface, /*codim=*/1); + {fe_ind_face_subface.begin(), + fe_ind_face_subface.end()}, + /*codim=*/1); AssertThrow( - dominating_fe_index != numbers::invalid_unsigned_int, + dominating_fe_index != numbers::invalid_fe_index, ExcMessage( "Could not find a least face dominating FE.")); @@ -1428,7 +1431,7 @@ namespace DoFTools ->n_active_fe_indices() == 1, ExcInternalError()); - const unsigned int subface_fe_index = + const types::fe_index subface_fe_index = cell->face(face)->child(sf)->nth_active_fe_index( 0); const FiniteElement &subface_fe = @@ -1609,23 +1612,23 @@ namespace DoFTools // to primary dofs based on the interpolation // matrix. - const unsigned int this_fe_index = + const types::fe_index this_fe_index = cell->active_fe_index(); - const unsigned int neighbor_fe_index = + const types::fe_index neighbor_fe_index = neighbor->active_fe_index(); - std::set fes; + std::set fes; fes.insert(this_fe_index); fes.insert(neighbor_fe_index); const dealii::hp::FECollection &fe_collection = dof_handler.get_fe_collection(); - const unsigned int dominating_fe_index = + // TODO: Change set to types::fe_index + const types::fe_index dominating_fe_index = fe_collection.find_dominating_fe_extended( - fes, /*codim=*/1); + {fes.begin(), fes.end()}, /*codim=*/1); AssertThrow( - dominating_fe_index != - numbers::invalid_unsigned_int, + dominating_fe_index != numbers::invalid_fe_index, ExcMessage( "Could not find the dominating FE for " + cell->get_fe().get_name() + " and " + @@ -1908,8 +1911,8 @@ namespace DoFTools // that is left is to match the corresponding DoFs of both faces. // - const unsigned int face_1_index = face_1->nth_active_fe_index(0); - const unsigned int face_2_index = face_2->nth_active_fe_index(0); + const types::fe_index face_1_index = face_1->nth_active_fe_index(0); + const types::fe_index face_2_index = face_2->nth_active_fe_index(0); Assert(face_1->get_fe(face_1_index) == face_2->get_fe(face_2_index), ExcMessage( "Matching periodic cells need to use the same finite element")); diff --git a/source/dofs/dof_tools_sparsity.cc b/source/dofs/dof_tools_sparsity.cc index 960ab2aa78..5afba2999f 100644 --- a/source/dofs/dof_tools_sparsity.cc +++ b/source/dofs/dof_tools_sparsity.cc @@ -187,8 +187,8 @@ namespace DoFTools (subdomain_id == cell->subdomain_id())) && cell->is_locally_owned()) { - const unsigned int fe_index = cell->active_fe_index(); - const unsigned int dofs_per_cell = + const types::fe_index fe_index = cell->active_fe_index(); + const unsigned int dofs_per_cell = fe_collection[fe_index].n_dofs_per_cell(); dofs_on_this_cell.resize(dofs_per_cell); diff --git a/source/hp/fe_collection.cc b/source/hp/fe_collection.cc index dfe9d317bc..d90012d775 100644 --- a/source/hp/fe_collection.cc +++ b/source/hp/fe_collection.cc @@ -239,7 +239,7 @@ namespace hp } // If we couldn't find the dominating object, return an invalid one. - return numbers::invalid_unsigned_int; + return numbers::invalid_fe_index; } @@ -286,7 +286,7 @@ namespace hp } // If we couldn't find the dominated object, return an invalid one. - return numbers::invalid_unsigned_int; + return numbers::invalid_fe_index; } @@ -299,7 +299,7 @@ namespace hp { unsigned int fe_index = find_dominating_fe(fes, codim); - if (fe_index == numbers::invalid_unsigned_int) + if (fe_index == numbers::invalid_fe_index) { const std::set dominating_fes = find_common_fes(fes, codim); @@ -319,7 +319,7 @@ namespace hp { unsigned int fe_index = find_dominated_fe(fes, codim); - if (fe_index == numbers::invalid_unsigned_int) + if (fe_index == numbers::invalid_fe_index) { const std::set dominated_fes = find_enclosing_fes(fes, codim); diff --git a/tests/hp/crash_17.cc b/tests/hp/crash_17.cc index ce5fed866b..8c86492ffe 100644 --- a/tests/hp/crash_17.cc +++ b/tests/hp/crash_17.cc @@ -506,7 +506,8 @@ LaplaceProblem::refine_grid() { cell->clear_refine_flag(); cell->set_active_fe_index( - std::min(cell->active_fe_index() + 1, fe_collection.size() - 1)); + std::min(cell->active_fe_index() + 1, + fe_collection.size() - 1)); } } diff --git a/tests/hp/crash_18.cc b/tests/hp/crash_18.cc index 05ac3301f2..4e7c74848b 100644 --- a/tests/hp/crash_18.cc +++ b/tests/hp/crash_18.cc @@ -514,7 +514,8 @@ LaplaceProblem::refine_grid() { cell->clear_refine_flag(); cell->set_active_fe_index( - std::min(cell->active_fe_index() + 1, fe_collection.size() - 1)); + std::min(cell->active_fe_index() + 1, + fe_collection.size() - 1)); } } diff --git a/tests/hp/fe_collection_05.cc b/tests/hp/fe_collection_05.cc index e1161b5209..6d97013b48 100644 --- a/tests/hp/fe_collection_05.cc +++ b/tests/hp/fe_collection_05.cc @@ -22,10 +22,10 @@ // {Q1, Q2, Q3, Q4} with {2,3} => Q3 2 // {Q1xQ1, Q2xQ2, Q3xQ4, Q4xQ3} with {2,3} => Q2xQ2 1 // {Q1xQ1, Q3xQ4, Q4xQ3} with {1,2} => Q1xQ1 0 -// {0x0, 0x0, Q1x0, 0xQ1} with {2,3} => none invalid_unsigned_int +// {0x0, 0x0, Q1x0, 0xQ1} with {2,3} => none invalid_fe_index // {0x0, 0x0, Q1x0, 0xQ1} with {2,3} => 0x0 0 (with dominating FE_Nothing) // {Q1xQ1, Q1xQ1, Q2xQ1, Q1xQ2} with {2,3} => Q1xQ1 0 -// {Q4xQ4, Q5xQ5, Q3xQ4, Q4xQ3} with {2,3} => none invalid_unsigned_int +// {Q4xQ4, Q5xQ5, Q3xQ4, Q4xQ3} with {2,3} => none invalid_fe_index // {Q1, Q2, Q4, Q3} with {3} => Q3 3 // {Q3, Q4, Q1, Q1} with {2,3} => Q1 2 (self-domination) /* clang-format on */ @@ -97,8 +97,8 @@ test() FESystem(FE_Nothing(), 1, FE_Q(1), 1)); const unsigned int ind = fe_collection.find_dominating_fe_extended(fes, /*codim=*/1); - if (ind == numbers::invalid_unsigned_int) - deallog << "numbers::invalid_unsigned_int" << std::endl; + if (ind == numbers::invalid_fe_index) + deallog << "numbers::invalid_fe_index" << std::endl; else deallog << ind << std::endl; } @@ -140,8 +140,8 @@ test() fe_collection.push_back(FESystem(FE_Q(4), 1, FE_Q(3), 1)); const unsigned int ind = fe_collection.find_dominating_fe_extended(fes, /*codim=*/1); - if (ind == numbers::invalid_unsigned_int) - deallog << "numbers::invalid_unsigned_int" << std::endl; + if (ind == numbers::invalid_fe_index) + deallog << "numbers::invalid_fe_index" << std::endl; else deallog << ind << std::endl; } diff --git a/tests/hp/fe_collection_05.output b/tests/hp/fe_collection_05.output index e333ddf30c..105278ab84 100644 --- a/tests/hp/fe_collection_05.output +++ b/tests/hp/fe_collection_05.output @@ -2,19 +2,19 @@ DEAL::2 DEAL::1 DEAL::0 -DEAL::numbers::invalid_unsigned_int +DEAL::numbers::invalid_fe_index DEAL::0 DEAL::0 -DEAL::numbers::invalid_unsigned_int +DEAL::numbers::invalid_fe_index DEAL::3 DEAL::2 DEAL::2 DEAL::1 DEAL::0 -DEAL::numbers::invalid_unsigned_int +DEAL::numbers::invalid_fe_index DEAL::0 DEAL::0 -DEAL::numbers::invalid_unsigned_int +DEAL::numbers::invalid_fe_index DEAL::3 DEAL::2 DEAL::OK diff --git a/tests/hp/fe_collection_06.cc b/tests/hp/fe_collection_06.cc index 075a3f3840..97e746d725 100644 --- a/tests/hp/fe_collection_06.cc +++ b/tests/hp/fe_collection_06.cc @@ -22,10 +22,10 @@ // {Q1, Q2, Q3, Q4} with {2,3} => Q4 3 // {Q5xQ5, Q4xQ4, Q3xQ4, Q4xQ3} with {2,3} => Q4xQ4 1 // {Q5xQ5, Q3xQ4, Q4xQ3} with {2,3} => Q5xQ5 0 -// {Q1x0, 0xQ1, 0x0, 0x0} with {2,3} => none invalid_unsigned_int +// {Q1x0, 0xQ1, 0x0, 0x0} with {2,3} => none invalid_fe_index // {Q1x0, 0xQ1, 0x0, 0x0} with {2,3} => 0x0 2 (with dominating FE_Nothing) // {Q2xQ2, Q2xQ2, Q2xQ1, Q1xQ2} with {2,3} => Q2xQ2 0 -// {Q2xQ2, Q3xQ3, Q3xQ4, Q4xQ3} with {2,3} => none invalid_unsigned_int +// {Q2xQ2, Q3xQ3, Q3xQ4, Q4xQ3} with {2,3} => none invalid_fe_index // {Q1, Q2, Q4, Q3} with {3} => Q3 3 // {Q3, Q4, Q1, Q1} with {2,3} => Q1 2 (self-domination) /* clang-format on */ @@ -96,8 +96,8 @@ test() FESystem(FE_Nothing(), 1, FE_Nothing(), 1)); const unsigned int ind = fe_collection.find_dominated_fe_extended(fes, /*codim=*/1); - if (ind == numbers::invalid_unsigned_int) - deallog << "numbers::invalid_unsigned_int" << std::endl; + if (ind == numbers::invalid_fe_index) + deallog << "numbers::invalid_fe_index" << std::endl; else deallog << ind << std::endl; } @@ -139,8 +139,8 @@ test() fe_collection.push_back(FESystem(FE_Q(4), 1, FE_Q(3), 1)); const unsigned int ind = fe_collection.find_dominated_fe_extended(fes, /*codim=*/1); - if (ind == numbers::invalid_unsigned_int) - deallog << "numbers::invalid_unsigned_int" << std::endl; + if (ind == numbers::invalid_fe_index) + deallog << "numbers::invalid_fe_index" << std::endl; else deallog << ind << std::endl; } diff --git a/tests/hp/fe_collection_06.output b/tests/hp/fe_collection_06.output index 59f0566c32..7c3f39f5f8 100644 --- a/tests/hp/fe_collection_06.output +++ b/tests/hp/fe_collection_06.output @@ -2,19 +2,19 @@ DEAL:2D::3 DEAL:2D::1 DEAL:2D::0 -DEAL:2D::numbers::invalid_unsigned_int +DEAL:2D::numbers::invalid_fe_index DEAL:2D::2 DEAL:2D::0 -DEAL:2D::numbers::invalid_unsigned_int +DEAL:2D::numbers::invalid_fe_index DEAL:2D::3 DEAL:2D::2 DEAL:3D::3 DEAL:3D::1 DEAL:3D::0 -DEAL:3D::numbers::invalid_unsigned_int +DEAL:3D::numbers::invalid_fe_index DEAL:3D::2 DEAL:3D::0 -DEAL:3D::numbers::invalid_unsigned_int +DEAL:3D::numbers::invalid_fe_index DEAL:3D::3 DEAL:3D::2 DEAL::OK diff --git a/tests/hp/get_active_fe_indices.cc b/tests/hp/get_active_fe_indices.cc index e4319dba37..36461c64ec 100644 --- a/tests/hp/get_active_fe_indices.cc +++ b/tests/hp/get_active_fe_indices.cc @@ -59,7 +59,7 @@ test() dof_handler.distribute_dofs(fe_collection); - std::vector active_fe_indices = + const std::vector active_fe_indices = dof_handler.get_active_fe_indices(); for (unsigned int i = 0; i < tria.n_active_cells(); ++i) deallog << active_fe_indices[i] << std::endl; diff --git a/tests/matrix_free/fe_nothing_01.cc b/tests/matrix_free/fe_nothing_01.cc index 1a21edc067..1d1f482d03 100644 --- a/tests/matrix_free/fe_nothing_01.cc +++ b/tests/matrix_free/fe_nothing_01.cc @@ -41,8 +41,8 @@ test() DoFHandler dof(tria); { - std::vector active_indices(tria.n_active_cells()); - for (unsigned i = 0; i < tria.n_active_cells() / 2; ++i) + std::vector active_indices(tria.n_active_cells()); + for (unsigned int i = 0; i < tria.n_active_cells() / 2; ++i) active_indices[i] = 1; dof.set_active_fe_indices(active_indices); diff --git a/tests/multigrid-global-coarsening/mg_transfer_p_02.cc b/tests/multigrid-global-coarsening/mg_transfer_p_02.cc index 594e3c8a6c..829acc6341 100644 --- a/tests/multigrid-global-coarsening/mg_transfer_p_02.cc +++ b/tests/multigrid-global-coarsening/mg_transfer_p_02.cc @@ -34,7 +34,7 @@ #include #include -#include +#include #include #include @@ -102,7 +102,7 @@ do_test() { if (cell->is_locally_owned()) cell->set_active_fe_index( - std::max(((cell)->active_fe_index() + 1) / 2 /*bisection*/, + std::max((cell->active_fe_index() + 1u) / 2 /*bisection*/, 1u) - 1); } @@ -115,8 +115,7 @@ do_test() { if (cell->is_locally_owned()) cell->set_active_fe_index( - std::max(((cell_other)->active_fe_index() + 1) / - 2 /*bisection*/, + std::max((cell_other->active_fe_index() + 1u) / 2 /*bisection*/, 1u) - 1); cell_other++; @@ -151,7 +150,7 @@ do_test() // break if all cells on coarse level have active_fe_index=0 { - unsigned int min = 0; + types::fe_index min = 0; for (auto &cell : dof_handler_coarse.active_cell_iterators()) { -- 2.39.5