From a96306a55f4b87208e1e3a4fac4645fe94853c21 Mon Sep 17 00:00:00 2001 From: bangerth Date: Thu, 27 Jul 2006 16:20:40 +0000 Subject: [PATCH] Provide nth_active_fe_index. Simplify implementation of n_active_fe_indices, since the result is predictable for non-hp DoFHandlers. git-svn-id: https://svn.dealii.org/trunk@13447 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/dofs/dof_handler.h | 63 ++++++++- deal.II/deal.II/source/dofs/dof_handler.cc | 142 +-------------------- 2 files changed, 63 insertions(+), 142 deletions(-) diff --git a/deal.II/deal.II/include/dofs/dof_handler.h b/deal.II/deal.II/include/dofs/dof_handler.h index e2713aeb3f..d5f3c99f99 100644 --- a/deal.II/deal.II/include/dofs/dof_handler.h +++ b/deal.II/deal.II/include/dofs/dof_handler.h @@ -1121,13 +1121,30 @@ class DoFHandler : public Subscriptor const unsigned int global_index) const; /** - * Number of active fe-indices, - * calls the respective - * function in DoFObjects + * 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 @@ -1381,6 +1398,46 @@ set_vertex_dof_index (const unsigned int vertex_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, + const unsigned int) const +{ + return 1; +} + + + +template +template +inline +unsigned int +DoFHandler::nth_active_fe_index (const unsigned int, + const unsigned int, + const unsigned int n) const +{ + Assert (n == 0, ExcIndexRange (n, 0, 1)); + + return default_fe_index; +} + + #endif // DOXYGEN /*---------------------------- dof_handler.h ---------------------------*/ diff --git a/deal.II/deal.II/source/dofs/dof_handler.cc b/deal.II/deal.II/source/dofs/dof_handler.cc index a6ed831b6a..05c93a1e3b 100644 --- a/deal.II/deal.II/source/dofs/dof_handler.cc +++ b/deal.II/deal.II/source/dofs/dof_handler.cc @@ -1405,30 +1405,6 @@ DoFHandler<1>::set_dof_index<1> (const unsigned int obj_level, global_index); } - - -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); -} - - -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); -} #endif #if deal_II_dimension == 2 @@ -1467,29 +1443,6 @@ DoFHandler<2>::set_dof_index<1> (const unsigned int , } -template <> -template <> -bool -DoFHandler<2>::fe_index_is_active<1> (const unsigned int , - const unsigned int obj_index, - const unsigned int fe_index) const -{ - return this->faces->lines.fe_index_is_active(*this, - obj_index, - fe_index); -} - - -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 <> @@ -1524,30 +1477,6 @@ DoFHandler<2>::set_dof_index<2> (const unsigned int obj_level, global_index); } - - -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); -} - - -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); -} #endif #if deal_II_dimension == 3 @@ -1586,28 +1515,6 @@ DoFHandler<3>::set_dof_index<1> (const unsigned int , } -template <> -template <> -bool -DoFHandler<3>::fe_index_is_active<1> (const unsigned int , - const unsigned int obj_index, - const unsigned int fe_index) const -{ - return this->faces->lines.fe_index_is_active(*this, - obj_index, - fe_index); -} - - -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 <> @@ -1625,6 +1532,7 @@ DoFHandler<3>::get_dof_index<2> (const unsigned int , } + template <> template <> unsigned int @@ -1641,6 +1549,7 @@ DoFHandler<3>::get_dof_index<3> (const unsigned int obj_level, } + template <> template <> void @@ -1660,6 +1569,7 @@ DoFHandler<3>::set_dof_index<2> (const unsigned int , } + template <> template <> void @@ -1677,52 +1587,6 @@ DoFHandler<3>::set_dof_index<3> (const unsigned int obj_level, global_index); } - - -template <> -template <> -bool -DoFHandler<3>::fe_index_is_active<2> (const unsigned int , - const unsigned int obj_index, - const unsigned int fe_index) const -{ - return this->faces->quads.fe_index_is_active(*this, - obj_index, - fe_index); -} - -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); -} - - -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>::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); -} #endif -- 2.39.5