From 382af9334342931733fbf4ee03f4516208f44653 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 26 Apr 2006 15:45:53 +0000 Subject: [PATCH] Clean up a few things in the hp parts. For example, some functions only make sense for dim==structdim. git-svn-id: https://svn.dealii.org/trunk@12908 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/dofs/dof_accessor.templates.h | 138 +++++++++--------- 1 file changed, 70 insertions(+), 68 deletions(-) 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 5c5d63f909..f719da3dcc 100644 --- a/deal.II/deal.II/include/dofs/dof_accessor.templates.h +++ b/deal.II/deal.II/include/dofs/dof_accessor.templates.h @@ -1096,6 +1096,10 @@ DoFObjectAccessor<1,hp::DoFHandler<1> >::dof_index (const unsigned int i) const Assert (iget_fe().dofs_per_line, ExcIndexRange (i, 0, this->get_fe().dofs_per_line)); + // for lines in 1d, we only have to + // take care of the offset, no + // linked lists or whatever (see + // hp::DoFLevels) const unsigned int offset = this->dof_handler->levels[this->present_level] ->dof_line_index_offset[this->present_index]; Assert (offset != this->dof_handler->invalid_dof_index, @@ -1108,6 +1112,7 @@ DoFObjectAccessor<1,hp::DoFHandler<1> >::dof_index (const unsigned int i) const } + template <> inline unsigned int @@ -1145,6 +1150,7 @@ DoFObjectAccessor<1,hp::DoFHandler<2> >::dof_index (const unsigned int i) const } + template <> inline unsigned int @@ -1202,6 +1208,10 @@ DoFObjectAccessor<1,hp::DoFHandler<1> >::set_dof_index (const unsigned int i, Assert (iget_fe().dofs_per_line, ExcIndexRange (i, 0, this->get_fe().dofs_per_line)); + // for lines in 1d, we only have to + // take care of the offset, no + // linked lists or whatever (see + // hp::DoFLevels) const unsigned int offset = this->dof_handler->levels[this->present_level] ->dof_line_index_offset[this->present_index]; Assert (offset != this->dof_handler->invalid_dof_index, @@ -1214,6 +1224,7 @@ DoFObjectAccessor<1,hp::DoFHandler<1> >::set_dof_index (const unsigned int i, } + template <> inline void @@ -1249,6 +1260,7 @@ DoFObjectAccessor<1, hp::DoFHandler<2> >::set_dof_index (const unsigned int i, } + template <> inline void @@ -1297,7 +1309,10 @@ inline const FiniteElement<2> & DoFObjectAccessor<1,hp::DoFHandler<2> >::get_fe () const { - return (*dof_handler->finite_elements)[active_fe_index ()]; + Assert (false, ExcMessage ("Only cells, not lower-dimensional objects, are " + "associated with active_fe_indices and corresponding " + "finite element objects")); + return (*dof_handler->finite_elements)[0]; } @@ -1307,7 +1322,10 @@ inline const FiniteElement<3> & DoFObjectAccessor<1,hp::DoFHandler<3> >::get_fe () const { - return (*dof_handler->finite_elements)[active_fe_index ()]; + Assert (false, ExcMessage ("Only cells, not lower-dimensional objects, are " + "associated with active_fe_indices and corresponding " + "finite element objects")); + return (*dof_handler->finite_elements)[0]; } @@ -1334,14 +1352,10 @@ inline unsigned int DoFObjectAccessor<1,hp::DoFHandler<2> >::active_fe_index () const { - Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), - ExcMessage ("DoFHandler not initialized")); - Assert (static_cast::size_type>(this->present_index) < - 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 ())); - return this->dof_handler->levels[this->present_level] - ->active_fe_indices[this->present_index]; + Assert (false, ExcMessage ("Only cells, not lower-dimensional objects, are " + "associated with active_fe_indices and corresponding " + "finite element objects")); + return 0; } @@ -1351,14 +1365,10 @@ inline unsigned int DoFObjectAccessor<1,hp::DoFHandler<3> >::active_fe_index () const { - Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), - ExcMessage ("DoFHandler not initialized")); - Assert (static_cast::size_type>(this->present_index) < - 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 ())); - return this->dof_handler->levels[this->present_level] - ->active_fe_indices[this->present_index]; + Assert (false, ExcMessage ("Only cells, not lower-dimensional objects, are " + "associated with active_fe_indices and corresponding " + "finite element objects")); + return 0; } @@ -1387,20 +1397,11 @@ DoFObjectAccessor<1,hp::DoFHandler<1> >::set_active_fe_index (const unsigned int template <> inline void -DoFObjectAccessor<1,hp::DoFHandler<2> >::set_active_fe_index (const unsigned int i) +DoFObjectAccessor<1,hp::DoFHandler<2> >::set_active_fe_index (const unsigned int) { - Assert (this->dof_handler != 0, ExcInvalidObject()); - Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), - ExcMessage ("DoFHandler not initialized")); - Assert (static_cast::size_type>(this->present_index) < - 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->finite_elements->size (), - ExcIndexRange(i, 0, this->dof_handler->finite_elements->size ())); - - this->dof_handler->levels[this->present_level] - ->active_fe_indices[this->present_index] = i; + Assert (false, ExcMessage ("Only cells, not lower-dimensional objects, are " + "associated with active_fe_indices and corresponding " + "finite element objects")); } @@ -1408,20 +1409,11 @@ DoFObjectAccessor<1,hp::DoFHandler<2> >::set_active_fe_index (const unsigned int template <> inline void -DoFObjectAccessor<1,hp::DoFHandler<3> >::set_active_fe_index (const unsigned int i) +DoFObjectAccessor<1,hp::DoFHandler<3> >::set_active_fe_index (const unsigned int) { - Assert (this->dof_handler != 0, ExcInvalidObject()); - Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), - ExcMessage ("DoFHandler not initialized")); - Assert (static_cast::size_type>(this->present_index) < - 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->finite_elements->size (), - ExcIndexRange(i, 0, this->dof_handler->finite_elements->size ())); - - this->dof_handler->levels[this->present_level] - ->active_fe_indices[this->present_index] = i; + Assert (false, ExcMessage ("Only cells, not lower-dimensional objects, are " + "associated with active_fe_indices and corresponding " + "finite element objects")); } @@ -1444,6 +1436,10 @@ unsigned int DoFObjectAccessor<2,hp::DoFHandler<2> >::dof_index (const unsigned Assert (iget_fe().dofs_per_quad, ExcIndexRange (i, 0, this->get_fe().dofs_per_quad)); + // for quads in 2d, we only have to + // take care of the offset, no + // linked lists or whatever (see + // hp::DoFLevels) const unsigned int offset = this->dof_handler->levels[this->present_level] ->dof_quad_index_offset[this->present_index]; Assert (offset != this->dof_handler->invalid_dof_index, @@ -1506,6 +1502,10 @@ DoFObjectAccessor<2, hp::DoFHandler<2> >::set_dof_index (const unsigned int i, Assert (iget_fe().dofs_per_quad, ExcIndexRange (i, 0, this->get_fe().dofs_per_quad)); + // for quads in 2d, we only have to + // take care of the offset, no + // linked lists or whatever (see + // hp::DoFLevels) const unsigned int offset = this->dof_handler->levels[this->present_level] ->dof_quad_index_offset[this->present_index]; Assert (offset != this->dof_handler->invalid_dof_index, @@ -1523,7 +1523,7 @@ template <> inline void DoFObjectAccessor<2, hp::DoFHandler<3> >::set_dof_index (const unsigned int i, - const unsigned int index) const + const unsigned int index) const { typedef DoFAccessor > BaseClass; @@ -1566,11 +1566,15 @@ inline const FiniteElement<3> & DoFObjectAccessor<2,hp::DoFHandler<3> >::get_fe () const { - return (*dof_handler->finite_elements)[active_fe_index ()]; + Assert (false, ExcMessage ("Only cells, not lower-dimensional objects, are " + "associated with active_fe_indices and corresponding " + "finite element objects")); + return (*dof_handler->finite_elements)[0]; } + template <> inline unsigned int @@ -1588,22 +1592,20 @@ DoFObjectAccessor<2,hp::DoFHandler<2> >::active_fe_index () const + template <> inline unsigned int DoFObjectAccessor<2,hp::DoFHandler<3> >::active_fe_index () const { - Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), - ExcMessage ("DoFHandler not initialized")); - Assert (static_cast::size_type>(this->present_index) < - 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 ())); - return this->dof_handler->levels[this->present_level] - ->active_fe_indices[this->present_index]; + Assert (false, ExcMessage ("Only cells, not lower-dimensional objects, are " + "associated with active_fe_indices and corresponding " + "finite element objects")); + return 0; } + template <> inline void @@ -1630,20 +1632,11 @@ DoFObjectAccessor<2,hp::DoFHandler<2> >::set_active_fe_index (const unsigned int template <> inline void -DoFObjectAccessor<2,hp::DoFHandler<3> >::set_active_fe_index (const unsigned int i) +DoFObjectAccessor<2,hp::DoFHandler<3> >::set_active_fe_index (const unsigned int) { - Assert (this->dof_handler != 0, ExcInvalidObject()); - Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), - ExcMessage ("DoFHandler not initialized")); - Assert (static_cast::size_type>(this->present_index) < - 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->finite_elements->size (), - ExcIndexRange(i, 0, this->dof_handler->finite_elements->size ())); - - this->dof_handler->levels[this->present_level] - ->active_fe_indices[this->present_index] = i; + Assert (false, ExcMessage ("Only cells, not lower-dimensional objects, are " + "associated with active_fe_indices and corresponding " + "finite element objects")); } @@ -1667,6 +1660,10 @@ DoFObjectAccessor<3,hp::DoFHandler<3> >::dof_index (const unsigned int i) const Assert (iget_fe().dofs_per_hex, ExcIndexRange (i, 0, this->get_fe().dofs_per_hex)); + // for hexes in 3d, we only have to + // take care of the offset, no + // linked lists or whatever (see + // hp::DoFLevels) const unsigned int offset = this->dof_handler->levels[this->present_level] ->dof_hex_index_offset[this->present_index]; Assert (offset != this->dof_handler->invalid_dof_index, @@ -1679,11 +1676,12 @@ DoFObjectAccessor<3,hp::DoFHandler<3> >::dof_index (const unsigned int i) const } + template <> inline void DoFObjectAccessor<3, hp::DoFHandler<3> >::set_dof_index (const unsigned int i, - const unsigned int index) const + const unsigned int index) const { typedef DoFAccessor > BaseClass; @@ -1698,6 +1696,10 @@ DoFObjectAccessor<3, hp::DoFHandler<3> >::set_dof_index (const unsigned int i, Assert (iget_fe().dofs_per_hex, ExcIndexRange (i, 0, this->get_fe().dofs_per_hex)); + // for hexes in 3d, we only have to + // take care of the offset, no + // linked lists or whatever (see + // hp::DoFLevels) const unsigned int offset = this->dof_handler->levels[this->present_level] ->dof_hex_index_offset[this->present_index]; Assert (offset != this->dof_handler->invalid_dof_index, -- 2.39.5