From: Wolfgang Bangerth Date: Tue, 2 May 2006 21:49:32 +0000 (+0000) Subject: Don't check the argument passed to set_active_fe_index since at that time no finite... X-Git-Tag: v8.0.0~11804 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33dabdaff6dfcf680575caff021cdcd716703df0;p=dealii.git Don't check the argument passed to set_active_fe_index since at that time no finite element collection may be associated with the hp::DoFHandler. Rather, check at the time we do distribute_dofs again. git-svn-id: https://svn.dealii.org/trunk@12982 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 d55facc66b..3c131acb23 100644 --- a/deal.II/deal.II/include/dofs/dof_accessor.templates.h +++ b/deal.II/deal.II/include/dofs/dof_accessor.templates.h @@ -795,8 +795,6 @@ DoFCellAccessor >::set_active_fe_index (const unsigned int i) this->dof_handler->levels[this->present_level]->active_fe_indices.size (), ExcIndexRange (this->present_index, 0, this->dof_handler->levels[this->present_level]->active_fe_indices.size ())); - Assert (i < this->dof_handler->get_fe().size (), - ExcIndexRange(i, 0, this->dof_handler->get_fe().size ())); this->dof_handler->levels[this->present_level] ->active_fe_indices[this->present_index] = i; } @@ -817,8 +815,6 @@ DoFCellAccessor >::set_active_fe_index (const unsigned int i) this->dof_handler->levels[this->present_level]->active_fe_indices.size (), ExcIndexRange (this->present_index, 0, this->dof_handler->levels[this->present_level]->active_fe_indices.size ())); - Assert (i < this->dof_handler->get_fe().size (), - ExcIndexRange(i, 0, this->dof_handler->get_fe().size ())); this->dof_handler->levels[this->present_level] ->active_fe_indices[this->present_index] = i; } @@ -839,8 +835,6 @@ DoFCellAccessor >::set_active_fe_index (const unsigned int i) this->dof_handler->levels[this->present_level]->active_fe_indices.size (), ExcIndexRange (this->present_index, 0, this->dof_handler->levels[this->present_level]->active_fe_indices.size ())); - Assert (i < this->dof_handler->get_fe().size (), - ExcIndexRange(i, 0, this->dof_handler->get_fe().size ())); this->dof_handler->levels[this->present_level] ->active_fe_indices[this->present_index] = i; } diff --git a/deal.II/deal.II/include/dofs/hp_dof_handler.h b/deal.II/deal.II/include/dofs/hp_dof_handler.h index 74b1c5d533..1967901f84 100644 --- a/deal.II/deal.II/include/dofs/hp_dof_handler.h +++ b/deal.II/deal.II/include/dofs/hp_dof_handler.h @@ -892,7 +892,15 @@ namespace hp int, << "The given list of new dof indices is not consecutive: " << "the index " << arg1 << " does not exist."); - + /** + * Exception + */ + DeclException2 (ExcInvalidFEIndex, + int, int, + << "The mesh contains a cell with an active_fe_index of " + << arg1 << ", but the finite element collection only has " + << arg2 << " elements"); + protected: /** diff --git a/deal.II/deal.II/source/dofs/hp_dof_handler.cc b/deal.II/deal.II/source/dofs/hp_dof_handler.cc index a33cb6a3c6..437bbfc07b 100644 --- a/deal.II/deal.II/source/dofs/hp_dof_handler.cc +++ b/deal.II/deal.II/source/dofs/hp_dof_handler.cc @@ -1523,7 +1523,17 @@ namespace hp Assert (tria->n_levels() > 0, ExcInvalidTriangulation()); finite_elements = &ff; - + + // up front make sure that the fe + // collection is large enough to + // cover all fe indices presently + // in use on the mesh + for (active_cell_iterator cell = begin_active(); cell != end(); ++cell) + Assert (cell->active_fe_index() < finite_elements->size(), + ExcInvalidFEIndex (cell->active_fe_index(), + finite_elements->size())); + + // This call ensures that the // active_fe_indices vectors are // initialized correctly.