From eed4ff20b6d999b35914e997be42a0ecab868b96 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Wed, 24 Jun 2020 12:29:32 +0200 Subject: [PATCH] Remove DoFHandlerType from dofs/dof_accessor --- .../changes/incompatibilities/20200624Munch | 5 + include/deal.II/dofs/dof_accessor.h | 276 ++-- include/deal.II/dofs/dof_accessor.templates.h | 1112 ++++++++--------- include/deal.II/dofs/dof_handler.h | 4 +- include/deal.II/dofs/dof_iterator_selector.h | 22 +- include/deal.II/fe/fe_values.h | 32 +- include/deal.II/grid/grid_tools.h | 8 +- include/deal.II/hp/fe_values.h | 15 +- include/deal.II/matrix_free/fe_evaluation.h | 10 +- .../numerics/derivative_approximation.h | 12 +- source/dofs/dof_accessor.cc | 61 +- source/dofs/dof_accessor.inst.in | 72 +- source/dofs/dof_accessor_get.cc | 12 +- source/dofs/dof_accessor_get.inst.in | 15 +- source/dofs/dof_accessor_set.cc | 12 +- source/dofs/dof_accessor_set.inst.in | 15 +- source/fe/fe_values.cc | 34 +- source/fe/fe_values.inst.in | 15 +- source/hp/fe_values.cc | 33 +- source/hp/fe_values.inst.in | 15 +- source/numerics/derivative_approximation.cc | 12 +- 21 files changed, 849 insertions(+), 943 deletions(-) create mode 100644 doc/news/changes/incompatibilities/20200624Munch diff --git a/doc/news/changes/incompatibilities/20200624Munch b/doc/news/changes/incompatibilities/20200624Munch new file mode 100644 index 0000000000..063d6e3028 --- /dev/null +++ b/doc/news/changes/incompatibilities/20200624Munch @@ -0,0 +1,5 @@ +Changed: The template arguments of the classes DoFAccessor and DoFCellAccessor have changed. +The template argument DoFHandlerType has been replaced by dimension and +space dimension. +
+(Peter Munch, 2020/06/24) diff --git a/include/deal.II/dofs/dof_accessor.h b/include/deal.II/dofs/dof_accessor.h index e5a7634cdb..21241cf7dc 100644 --- a/include/deal.II/dofs/dof_accessor.h +++ b/include/deal.II/dofs/dof_accessor.h @@ -188,8 +188,8 @@ namespace internal * @tparam structdim The dimensionality of the objects the accessor * represents. For example, points have @p structdim equal to zero, * edges have @p structdim equal to one, etc. - * @tparam DoFHandlerType The type of the DoF handler into which accessor - * of this type point. + * @tparam dim Dimension of the underlying DoFHandler. + * @tparam spacedim Space dimension of the underlying DoFHandler. * @tparam level_dof_access If @p false, then the accessor simply represents * a cell, face, or edge in a DoFHandler for which degrees of freedom only * exist on the finest level. Some operations are not allowed in this case, @@ -203,25 +203,22 @@ namespace internal * @ingroup dofs * @ingroup Accessors */ -template -class DoFAccessor - : public dealii::internal::DoFAccessorImplementation::Inheritance< - structdim, - DoFHandlerType::dimension, - DoFHandlerType::space_dimension>::BaseClass +template +class DoFAccessor : public dealii::internal::DoFAccessorImplementation:: + Inheritance::BaseClass { public: /** * A static variable that allows users of this class to discover the value * of the second template argument. */ - static const unsigned int dimension = DoFHandlerType::dimension; + static const unsigned int dimension = dim; /** * A static variable that allows users of this class to discover the value * of the third template argument. */ - static const unsigned int space_dimension = DoFHandlerType::space_dimension; + static const unsigned int space_dimension = spacedim; /** * Declare an alias to the base class to make accessing some of the @@ -233,7 +230,7 @@ public: /** * Data type passed by the iterator class. */ - using AccessorData = DoFHandlerType; + using AccessorData = DoFHandler; /** * @name Constructors @@ -262,11 +259,10 @@ public: * accessor shall refer. This DoFHandler object must of course be built on * the same triangulation as the one specified in the first argument. */ - DoFAccessor(const Triangulation *tria, - const int level, - const int index, - const DoFHandlerType *dof_handler); + DoFAccessor(const Triangulation *tria, + const int level, + const int index, + const DoFHandler * dof_handler); /** * Conversion constructor. This constructor exists to make certain @@ -287,15 +283,15 @@ public: * Another conversion operator between objects that don't make sense, just * like the previous one. */ - template - DoFAccessor(const DoFAccessor &); + template + DoFAccessor( + const DoFAccessor &); /** * Copy constructor allowing to switch level access and active access. */ template - DoFAccessor( - const DoFAccessor &); + DoFAccessor(const DoFAccessor &); /** * Copy operator. These operators are usually used in a context like @@ -306,9 +302,9 @@ public: * this operation is not useful for iterators on DoF handler objects. * Consequently, this operator is declared as deleted and can not be used. */ - DoFAccessor & - operator=(const DoFAccessor - &da) = delete; + DoFAccessor & + operator=(const DoFAccessor &da) = + delete; /** * @} @@ -317,7 +313,7 @@ public: /** * Return a handle on the DoFHandler object which we are using. */ - const DoFHandlerType & + const DoFHandler & get_dof_handler() const; /** @@ -325,16 +321,14 @@ public: */ template void - copy_from(const DoFAccessor &a); + copy_from(const DoFAccessor &a); /** * Copy operator used by the iterator class. Keeps the previously set dof * handler, but sets the object coordinates of the TriaAccessor. */ void - copy_from(const TriaAccessorBase &da); + copy_from(const TriaAccessorBase &da); /** * Tell the caller whether get_active_or_mg_dof_indices() accesses active or @@ -353,7 +347,7 @@ public: /** * Return an iterator pointing to the @p c-th child. */ - TriaIterator> + TriaIterator> child(const unsigned int c) const; /** @@ -362,7 +356,7 @@ public: * function returns an iterator to itself. */ typename dealii::internal::DoFHandlerImplementation:: - Iterators::line_iterator + Iterators, level_dof_access>::line_iterator line(const unsigned int i) const; /** @@ -371,7 +365,7 @@ public: * function returns an iterator to itself. */ typename dealii::internal::DoFHandlerImplementation:: - Iterators::quad_iterator + Iterators, level_dof_access>::quad_iterator quad(const unsigned int i) const; /** @@ -420,9 +414,9 @@ public: * cell-@>active_fe_index as last argument. */ void - get_dof_indices( - std::vector &dof_indices, - const unsigned int fe_index = DoFHandlerType::invalid_fe_index) const; + get_dof_indices(std::vector &dof_indices, + const unsigned int fe_index = + DoFHandler::invalid_fe_index) const; /** * Return the global multilevel indices of the degrees of freedom that live @@ -431,10 +425,10 @@ public: * level this line lives on. */ void - get_mg_dof_indices( - const int level, - std::vector &dof_indices, - const unsigned int fe_index = DoFHandlerType::invalid_fe_index) const; + get_mg_dof_indices(const int level, + std::vector &dof_indices, + const unsigned int fe_index = + DoFHandler::invalid_fe_index) const; /** * Set the level DoF indices that are returned by get_mg_dof_indices. @@ -443,7 +437,7 @@ public: set_mg_dof_indices( const int level, const std::vector &dof_indices, - const unsigned int fe_index = DoFHandlerType::invalid_fe_index); + const unsigned int fe_index = DoFHandler::invalid_fe_index); /** * Global DoF index of the i degree associated with the @p vertexth @@ -463,10 +457,10 @@ public: * fe_index has to match the result of active_fe_index(). */ types::global_dof_index - vertex_dof_index( - const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index = DoFHandlerType::invalid_fe_index) const; + vertex_dof_index(const unsigned int vertex, + const unsigned int i, + const unsigned int fe_index = + DoFHandler::invalid_fe_index) const; /** * Return the global DoF index of the ith degree of freedom @@ -474,11 +468,11 @@ public: * see vertex_dof_index(). */ types::global_dof_index - mg_vertex_dof_index( - const int level, - const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index = DoFHandlerType::invalid_fe_index) const; + mg_vertex_dof_index(const int level, + const unsigned int vertex, + const unsigned int i, + const unsigned int fe_index = + DoFHandler::invalid_fe_index) const; /** * Index of the ith degree of freedom of this object. @@ -508,9 +502,9 @@ public: * the face. */ types::global_dof_index - dof_index( - const unsigned int i, - const unsigned int fe_index = DoFHandlerType::invalid_fe_index) const; + dof_index(const unsigned int i, + const unsigned int fe_index = + DoFHandler::invalid_fe_index) const; /** * Return the dof_index on the given level. Also see dof_index. @@ -578,8 +572,7 @@ public: * given @p fe_index. @p fe_index must be used on this object, i.e. * fe_index_is_active(fe_index) must return true. */ - const FiniteElement & + const FiniteElement & get_fe(const unsigned int fe_index) const; /** @@ -631,7 +624,7 @@ protected: /** * Store the address of the DoFHandler object to be accessed. */ - DoFHandlerType *dof_handler; + DoFHandler *dof_handler; public: /** @@ -647,25 +640,25 @@ public: * an iterator with level access can be equal to one with access to the * active degrees of freedom. */ - template + template bool operator==( - const DoFAccessor &) const; + const DoFAccessor &) const; /** * Compare for inequality. The boolean not of operator==(). */ - template + template bool operator!=( - const DoFAccessor &) const; + const DoFAccessor &) const; protected: /** * Reset the DoF handler pointer. */ void - set_dof_handler(DoFHandlerType *dh); + set_dof_handler(DoFHandler *dh); /** * Set the index of the ith degree of freedom of this object to @p @@ -686,10 +679,10 @@ protected: * active_fe_index(). */ void - set_dof_index( - const unsigned int i, - const types::global_dof_index index, - const unsigned int fe_index = DoFHandlerType::invalid_fe_index) const; + set_dof_index(const unsigned int i, + const types::global_dof_index index, + const unsigned int fe_index = + DoFHandler::invalid_fe_index) const; void set_mg_dof_index(const int level, @@ -715,33 +708,33 @@ protected: * active_fe_index(). */ void - set_vertex_dof_index( - const unsigned int vertex, - const unsigned int i, - const types::global_dof_index index, - const unsigned int fe_index = DoFHandlerType::invalid_fe_index) const; + set_vertex_dof_index(const unsigned int vertex, + const unsigned int i, + const types::global_dof_index index, + const unsigned int fe_index = + DoFHandler::invalid_fe_index) const; void - set_mg_vertex_dof_index( - const int level, - const unsigned int vertex, - const unsigned int i, - const types::global_dof_index index, - const unsigned int fe_index = DoFHandlerType::invalid_fe_index) const; + set_mg_vertex_dof_index(const int level, + const unsigned int vertex, + const unsigned int i, + const types::global_dof_index index, + const unsigned int fe_index = + DoFHandler::invalid_fe_index) const; // Iterator classes need to be friends because they need to access // operator== and operator!=. template friend class TriaRawIterator; - template + template friend class DoFAccessor; private: // Make the DoFHandler class a friend so that it can call the set_xxx() // functions. - template + template friend class DoFHandler; - template + template friend class hp::DoFHandler; friend struct dealii::internal::DoFHandlerImplementation::Policy:: @@ -761,10 +754,8 @@ private: * general faces, this class does a few things differently than the general * template, but the interface should look the same. */ -template