From: bangerth Date: Tue, 9 Dec 2008 02:52:12 +0000 (+0000) Subject: Move a bunch more functions from the DoFHandler classes to the DoFAccessor Implementa... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cfd44b456120f5e435c5b69a32ff862c4a020fd0;p=dealii-svn.git Move a bunch more functions from the DoFHandler classes to the DoFAccessor Implementation class. This is, after all, the only location where these functions are called. git-svn-id: https://svn.dealii.org/trunk@17899 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/dofs/dof_accessor.templates.h b/deal.II/deal.II/include/dofs/dof_accessor.templates.h index a42e492009..f6d41b6fd6 100644 --- a/deal.II/deal.II/include/dofs/dof_accessor.templates.h +++ b/deal.II/deal.II/include/dofs/dof_accessor.templates.h @@ -697,6 +697,398 @@ namespace internal global_index, obj_level); } + + + template + static + bool + fe_index_is_active (const dealii::DoFHandler &, + const unsigned int, + const unsigned int, + const unsigned int fe_index, + const internal::int2type &) + { + return (fe_index == 0); + } + + + + template + static + unsigned int + n_active_fe_indices (const dealii::DoFHandler &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const internal::int2type &) + { + // check that the object we look + // at is in fact active. the + // problem is that we have + // templatized on the + // dimensionality of the object, + // so it may be a cell, a face, + // or a line. we have a bit of + // trouble doing this all in the + // generic case, so only check if + // it is either a cell or a + // line. the only case this + // leaves out is faces in 3d -- + // let's hope that this never is + // a problem + Assert ((dim==structdim + ? + typename + dealii::DoFHandler:: + raw_cell_iterator (&dof_handler.get_tria(), + obj_level, + obj_index, + &dof_handler)->used() + : + (structdim==1 + ? + typename + dealii::DoFHandler:: + raw_line_iterator (&dof_handler.get_tria(), + obj_level, + obj_index, + &dof_handler)->used() + : + true)) + == true, + ExcMessage ("This cell is not active and therefore can't be " + "queried for its active FE indices")); + return 1; + } + + + + template + static + unsigned int + nth_active_fe_index (const dealii::DoFHandler &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int n, + const internal::int2type &) + { + // check that the object we look + // at is in fact active. the + // problem is that we have + // templatized on the + // dimensionality of the object, + // so it may be a cell, a face, + // or a line. we have a bit of + // trouble doing this all in the + // generic case, so only check if + // it is either a cell or a + // line. the only case this + // leaves out is faces in 3d -- + // let's hope that this never is + // a problem + Assert ((dim==structdim + ? + typename + dealii::DoFHandler:: + raw_cell_iterator (&dof_handler.get_tria(), + obj_level, + obj_index, + &dof_handler)->used() + : + (structdim==1 + ? + typename + dealii::DoFHandler:: + raw_line_iterator (&dof_handler.get_tria(), + obj_level, + obj_index, + &dof_handler)->used() + : + true)) + == true, + ExcMessage ("This cell is not active and therefore can't be " + "queried for its active FE indices")); + Assert (n == 0, ExcIndexRange (n, 0, 1)); + + return dealii::DoFHandler::default_fe_index; + } + + + template + static + bool + fe_index_is_active (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const internal::int2type<1> &) + { + return dof_handler.levels[obj_level]->lines.fe_index_is_active(dof_handler, + obj_index, + fe_index, + obj_level); + } + + + template + static + unsigned int + n_active_fe_indices (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const internal::int2type<1> &) + { + return dof_handler.levels[obj_level]->lines.n_active_fe_indices (dof_handler, + obj_index); + } + + + + template + static + unsigned int + nth_active_fe_index (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int n, + const internal::int2type<1> &) + { + return dof_handler.levels[obj_level]->lines.nth_active_fe_index (dof_handler, + obj_level, + obj_index, + n); + } + + + template + static + bool + fe_index_is_active (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const internal::int2type<1> &) + { + return dof_handler.faces->lines.fe_index_is_active(dof_handler, + obj_index, + fe_index, + obj_level); + } + + + template + static + unsigned int + n_active_fe_indices (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int , + const unsigned int obj_index, + const internal::int2type<1> &) + { + return dof_handler.faces->lines.n_active_fe_indices (dof_handler, + obj_index); + } + + + template + static + unsigned int + nth_active_fe_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int n, + const internal::int2type<1> &) + { + return dof_handler.faces->lines.nth_active_fe_index (dof_handler, + obj_level, + obj_index, + n); + } + + + + template + static + bool + fe_index_is_active (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const internal::int2type<2> &) + { + return dof_handler.levels[obj_level]->quads.fe_index_is_active(dof_handler, + obj_index, + fe_index, + obj_level); + } + + + template + static + unsigned int + n_active_fe_indices (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const internal::int2type<2> &) + { + return dof_handler.levels[obj_level]->quads.n_active_fe_indices (dof_handler, + obj_index); + } + + + + template + static + unsigned int + nth_active_fe_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int n, + const internal::int2type<2> &) + { + return dof_handler.levels[obj_level]->quads.nth_active_fe_index (dof_handler, + obj_level, + obj_index, + n); + } + + + + template + static + bool + fe_index_is_active (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const internal::int2type<1> &) + { + return dof_handler.faces->lines.fe_index_is_active(dof_handler, + obj_index, + fe_index, + obj_level); + } + + + template + static + unsigned int + n_active_fe_indices (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int, + const unsigned int obj_index, + const internal::int2type<1> &) + { + return dof_handler.faces->lines.n_active_fe_indices (dof_handler, + obj_index); + } + + + + template + static + unsigned int + nth_active_fe_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int n, + const internal::int2type<1> &) + { + return dof_handler.faces->lines.nth_active_fe_index (dof_handler, + obj_level, + obj_index, + n); + } + + + + template + static + bool + fe_index_is_active (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const internal::int2type<2> &) + { + return dof_handler.faces->quads.fe_index_is_active(dof_handler, + obj_index, + fe_index, + obj_level); + } + + template + static + bool + fe_index_is_active (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const internal::int2type<3> &) + { + return dof_handler.levels[obj_level]->hexes.fe_index_is_active(dof_handler, + obj_index, + fe_index, + obj_level); + } + + + template + static + unsigned int + n_active_fe_indices (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int , + const unsigned int obj_index, + const internal::int2type<2> &) + { + return dof_handler.faces->quads.n_active_fe_indices (dof_handler, + obj_index); + } + + + + template + static + unsigned int + nth_active_fe_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int n, + const internal::int2type<2> &) + { + return dof_handler.faces->quads.nth_active_fe_index (dof_handler, + obj_level, + obj_index, + n); + } + + + + template + static + unsigned int + n_active_fe_indices (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const internal::int2type<3> &) + { + return dof_handler.levels[obj_level]->hexes.n_active_fe_indices (dof_handler, + obj_index); + } + + + + template + static + unsigned int + nth_active_fe_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int n, + const internal::int2type<3> &) + { + return dof_handler.levels[obj_level]->hexes.nth_active_fe_index (dof_handler, + obj_level, + obj_index, + n); + } }; } } @@ -745,9 +1137,12 @@ unsigned int DoFAccessor::n_active_fe_indices () const { // access the respective DoF - return this->dof_handler - ->template n_active_fe_indices (this->level(), - this->present_index); + return + internal::DoFAccessor::Implementation:: + n_active_fe_indices (*this->dof_handler, + this->level(), + this->present_index, + internal::int2type()); } @@ -758,10 +1153,13 @@ unsigned int DoFAccessor::nth_active_fe_index (const unsigned int n) const { // access the respective DoF - return this->dof_handler - ->template nth_active_fe_index (this->level(), - this->present_index, - n); + return + internal::DoFAccessor::Implementation:: + nth_active_fe_index (*this->dof_handler, + this->level(), + this->present_index, + n, + internal::int2type()); } @@ -772,10 +1170,13 @@ bool DoFAccessor::fe_index_is_active (const unsigned int fe_index) const { // access the respective DoF - return this->dof_handler - ->template fe_index_is_active (this->level(), - this->present_index, - fe_index); + return + internal::DoFAccessor::Implementation:: + fe_index_is_active (*this->dof_handler, + this->level(), + this->present_index, + fe_index, + internal::int2type()); } diff --git a/deal.II/deal.II/include/dofs/dof_handler.h b/deal.II/deal.II/include/dofs/dof_handler.h index ae310aa57c..f3c0eb0faa 100644 --- a/deal.II/deal.II/include/dofs/dof_handler.h +++ b/deal.II/deal.II/include/dofs/dof_handler.h @@ -1120,43 +1120,6 @@ class DoFHandler : public Subscriptor get_vertex_dof_index (const unsigned int vertex_index, const unsigned int fe_index, const unsigned int local_index) const; - - /** - * Return the number of active - * fe-indices on the given - * object. Since we have a non-hp - * handler here, this function - * always returns 1. - */ - template - unsigned int n_active_fe_indices (const unsigned int obj_level, - const unsigned int obj_index) const; - - /** - * Return the fe index of the - * n-th active finite element on - * this object. Since this is a - * non-hp object, there is - * exactly one active fe index; - * the function therefore asserts - * that @p n equals zero, and the - * returns default_fe_index. - */ - template - unsigned int nth_active_fe_index (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n) const; - - /** - * Return, wether fe-index is an - * active fe, calls the - * respective function in - * DoFObjects - */ - template - bool fe_index_is_active (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index) const; /** * Space to store the DoF numbers @@ -1287,105 +1250,10 @@ set_vertex_dof_index (const unsigned int vertex_index, selected_fe->dofs_per_vertex)); vertex_dofs[vertex_index * selected_fe->dofs_per_vertex + local_index] = global_index; -} - - - -template -template -inline -bool -DoFHandler::fe_index_is_active (const unsigned int, - const unsigned int, - const unsigned int fe_index) const -{ - return (fe_index == 0); } -template -template -inline -unsigned int -DoFHandler::n_active_fe_indices (const unsigned int obj_level, - const unsigned int obj_index) const -{ - // check that the object we look at is in - // fact active. the problem is that we have - // templatized on the dimensionality of the - // object, so it may be a cell, a face, or - // a line. we have a bit of trouble doing - // this all in the generic case, so only - // check if it is either a cell or a - // line. the only case this leaves out is - // faces in 3d -- let's hope that this - // never is a problem - Assert ((dim==structdim - ? - raw_cell_iterator (tria, - obj_level, - obj_index, - this)->used() - : - (structdim==1 - ? - raw_line_iterator (tria, - obj_level, - obj_index, - this)->used() - : - true)) - == true, - ExcMessage ("This cell is not active and therefore can't be " - "queried for the number of active FE indices")); - return 1; -} - - - -template -template -inline -unsigned int -DoFHandler::nth_active_fe_index (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n) const -{ - // check that the object we look at is in - // fact active. the problem is that we have - // templatized on the dimensionality of the - // object, so it may be a cell, a face, or - // a line. we have a bit of trouble doing - // this all in the generic case, so only - // check if it is either a cell or a - // line. the only case this leaves out is - // faces in 3d -- let's hope that this - // never is a problem - Assert ((dim==structdim - ? - raw_cell_iterator (tria, - obj_level, - obj_index, - this)->used() - : - (structdim==1 - ? - raw_line_iterator (tria, - obj_level, - obj_index, - this)->used() - : - true)) - == true, - ExcMessage ("This cell is not active and therefore can't be " - "queried for its active FE indices")); - Assert (n == 0, ExcIndexRange (n, 0, 1)); - - return default_fe_index; -} - - #endif // DOXYGEN DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/deal.II/include/hp/dof_handler.h b/deal.II/deal.II/include/hp/dof_handler.h index 7b50c313d5..593282ed3d 100644 --- a/deal.II/deal.II/include/hp/dof_handler.h +++ b/deal.II/deal.II/include/hp/dof_handler.h @@ -1069,36 +1069,6 @@ namespace hp fe_is_active_on_vertex (const unsigned int vertex_index, const unsigned int fe_index) const; - /** - * Number of active fe-indices, - * calls the respective - * function in DoFObjects - */ - template - unsigned int n_active_fe_indices (const unsigned int obj_level, - const unsigned int obj_index) const; - - /** - * Return the fe index of the - * n-th active finite element on - * this object. - */ - template - unsigned int nth_active_fe_index (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n) const; - - /** - * Return whether fe-index is - * an active fe, calls the - * respective function in - * DoFObjects - */ - template - bool fe_index_is_active (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index) const; - /** * Compute identities between * DoFs located on @@ -1263,7 +1233,6 @@ namespace hp */ template friend class internal::hp::DoFLevel; template friend class internal::hp::DoFObjects; - friend class internal::hp::DoFHandler::Implementation; }; diff --git a/deal.II/deal.II/source/hp/dof_handler.cc b/deal.II/deal.II/source/hp/dof_handler.cc index bea2b2087d..6c4e4850a6 100644 --- a/deal.II/deal.II/source/hp/dof_handler.cc +++ b/deal.II/deal.II/source/hp/dof_handler.cc @@ -2647,377 +2647,6 @@ namespace hp //------------------------------------------------------------------ -#if deal_II_dimension == 1 - - template <> - template <> - bool - DoFHandler<1>::fe_index_is_active<1> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index) const - { - return this->levels[obj_level]->lines.fe_index_is_active(*this, - obj_index, - fe_index, - obj_level); - } - - - template <> - template <> - unsigned int - DoFHandler<1>::n_active_fe_indices<1> (const unsigned int obj_level, - const unsigned int obj_index) const - { - return this->levels[obj_level]->lines.n_active_fe_indices (*this, - obj_index); - } - - - - template <> - template <> - unsigned int - DoFHandler<1>::nth_active_fe_index<1> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n) const - { - return this->levels[obj_level]->lines.nth_active_fe_index (*this, - obj_level, - obj_index, - n); - } - - - - template <> - template <> - bool - DoFHandler<1,2>::fe_index_is_active<1> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index) const - { - return this->levels[obj_level]->lines.fe_index_is_active(*this, - obj_index, - fe_index, - obj_level); - } - - - template <> - template <> - unsigned int - DoFHandler<1,2>::n_active_fe_indices<1> (const unsigned int obj_level, - const unsigned int obj_index) const - { - return this->levels[obj_level]->lines.n_active_fe_indices (*this, - obj_index); - } - - - - template <> - template <> - unsigned int - DoFHandler<1,2>::nth_active_fe_index<1> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n) const - { - return this->levels[obj_level]->lines.nth_active_fe_index (*this, - obj_level, - obj_index, - n); - } - -#endif - - -#if deal_II_dimension == 2 - template <> - template <> - bool - DoFHandler<2>::fe_index_is_active<1> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index) const - { - return this->faces->lines.fe_index_is_active(*this, - obj_index, - fe_index, - obj_level); - } - - - template <> - template <> - unsigned int - DoFHandler<2>::n_active_fe_indices<1> (const unsigned int , - const unsigned int obj_index) const - { - return this->faces->lines.n_active_fe_indices (*this, - obj_index); - } - - - template <> - template <> - unsigned int - DoFHandler<2>::nth_active_fe_index<1> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n) const - { - return this->faces->lines.nth_active_fe_index (*this, - obj_level, - obj_index, - n); - } - - - - template <> - template <> - bool - DoFHandler<2>::fe_index_is_active<2> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index) const - { - return this->levels[obj_level]->quads.fe_index_is_active(*this, - obj_index, - fe_index, - obj_level); - } - - - template <> - template <> - unsigned int - DoFHandler<2>::n_active_fe_indices<2> (const unsigned int obj_level, - const unsigned int obj_index) const - { - return this->levels[obj_level]->quads.n_active_fe_indices (*this, - obj_index); - } - - - - template <> - template <> - unsigned int - DoFHandler<2>::nth_active_fe_index<2> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n) const - { - return this->levels[obj_level]->quads.nth_active_fe_index (*this, - obj_level, - obj_index, - n); - } - - - template <> - template <> - bool - DoFHandler<2,3>::fe_index_is_active<1> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index) const - { - return this->faces->lines.fe_index_is_active(*this, - obj_index, - fe_index, - obj_level); - } - - - template <> - template <> - unsigned int - DoFHandler<2,3>::n_active_fe_indices<1> (const unsigned int , - const unsigned int obj_index) const - { - return this->faces->lines.n_active_fe_indices (*this, - obj_index); - } - - - template <> - template <> - unsigned int - DoFHandler<2,3>::nth_active_fe_index<1> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n) const - { - return this->faces->lines.nth_active_fe_index (*this, - obj_level, - obj_index, - n); - } - - - - template <> - template <> - bool - DoFHandler<2,3>::fe_index_is_active<2> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index) const - { - return this->levels[obj_level]->quads.fe_index_is_active(*this, - obj_index, - fe_index, - obj_level); - } - - - template <> - template <> - unsigned int - DoFHandler<2,3>::n_active_fe_indices<2> (const unsigned int obj_level, - const unsigned int obj_index) const - { - return this->levels[obj_level]->quads.n_active_fe_indices (*this, - obj_index); - } - - - - template <> - template <> - unsigned int - DoFHandler<2,3>::nth_active_fe_index<2> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n) const - { - return this->levels[obj_level]->quads.nth_active_fe_index (*this, - obj_level, - obj_index, - n); - } - - -#endif - -#if deal_II_dimension == 3 - template <> - template <> - bool - DoFHandler<3>::fe_index_is_active<1> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index) const - { - return this->faces->lines.fe_index_is_active(*this, - obj_index, - fe_index, - obj_level); - } - - - template <> - template <> - unsigned int - DoFHandler<3>::n_active_fe_indices<1> (const unsigned int, - const unsigned int obj_index) const - { - return this->faces->lines.n_active_fe_indices (*this, - obj_index); - } - - - - template <> - template <> - unsigned int - DoFHandler<3>::nth_active_fe_index<1> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n) const - { - return this->faces->lines.nth_active_fe_index (*this, - obj_level, - obj_index, - n); - } - - - - template <> - template <> - bool - DoFHandler<3>::fe_index_is_active<2> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index) const - { - return this->faces->quads.fe_index_is_active(*this, - obj_index, - fe_index, - obj_level); - } - - template <> - template <> - bool - DoFHandler<3>::fe_index_is_active<3> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index) const - { - return this->levels[obj_level]->hexes.fe_index_is_active(*this, - obj_index, - fe_index, - obj_level); - } - - - template <> - template <> - unsigned int - DoFHandler<3>::n_active_fe_indices<2> (const unsigned int , - const unsigned int obj_index) const - { - return this->faces->quads.n_active_fe_indices (*this, - obj_index); - } - - - - template <> - template <> - unsigned int - DoFHandler<3>::nth_active_fe_index<2> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n) const - { - return this->faces->quads.nth_active_fe_index (*this, - obj_level, - obj_index, - n); - } - - - - template <> - template <> - unsigned int - DoFHandler<3>::n_active_fe_indices<3> (const unsigned int obj_level, - const unsigned int obj_index) const - { - return this->levels[obj_level]->hexes.n_active_fe_indices (*this, - obj_index); - } - - - - template <> - template <> - unsigned int - DoFHandler<3>::nth_active_fe_index<3> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n) const - { - return this->levels[obj_level]->hexes.nth_active_fe_index (*this, - obj_level, - obj_index, - n); - } -#endif - - #if deal_II_dimension == 1