From 6c2741cb82db61dd18e1d8c55790195540d1c7d6 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 1 May 2006 21:29:08 +0000 Subject: [PATCH] More moving around to allow sharing code between non-hp and hp accessors. Also move control over the format for data storage to the classes that actually handle it git-svn-id: https://svn.dealii.org/trunk@12944 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/dofs/dof_accessor.h | 546 ++++-------------- .../include/dofs/dof_accessor.templates.h | 391 +++---------- deal.II/deal.II/include/dofs/dof_handler.h | 116 ++++ deal.II/deal.II/include/dofs/hp_dof_handler.h | 127 +++- deal.II/deal.II/include/dofs/hp_dof_levels.h | 17 - deal.II/deal.II/source/dofs/dof_accessor.cc | 185 ------ deal.II/deal.II/source/dofs/hp_dof_levels.cc | 109 ---- 7 files changed, 436 insertions(+), 1055 deletions(-) diff --git a/deal.II/deal.II/include/dofs/dof_accessor.h b/deal.II/deal.II/include/dofs/dof_accessor.h index 45563660f7..e1c63110f3 100644 --- a/deal.II/deal.II/include/dofs/dof_accessor.h +++ b/deal.II/deal.II/include/dofs/dof_accessor.h @@ -188,7 +188,133 @@ class DoFAccessor : public DoFObjectAccessor_Inheritance &a); /** - * Exception for child classes + * Return an iterator pointing to + * the the @p c-th child. + */ + TriaIterator > + child (const unsigned int c) const; + + /** + * Set the index of the + * ith degree of freedom + * of this object to @p index. + * + * The last argument denotes the + * finite element index. For the + * standard ::DoFHandler class, + * this value must be equal to + * its default value since that + * class only supports the same + * finite element on all cells + * anyway. + * + * However, for hp objects + * (i.e. the hp::DoFHandler + * class), different finite + * element objects may be used on + * different cells. On faces + * between two cells, as well as + * vertices, there may therefore + * be two sets of degrees of + * freedom, one for each of the + * finite elements used on the + * adjacent cells. In order to + * specify which set of degrees + * of freedom to work on, the + * last argument is used to + * disambiguate. Finally, if this + * function is called for a cell + * object, there can only be a + * single set of degrees of + * freedom, and fe_index has to + * match the result of + * active_fe_index(). + */ + void set_dof_index (const unsigned int i, + const unsigned int index, + const unsigned int fe_index = DH::default_fe_index) const; + + /** + * Index of the i degree + * on the @p vertexth vertex. + * + * The last argument denotes the + * finite element index. For the + * standard ::DoFHandler class, + * this value must be equal to + * its default value since that + * class only supports the same + * finite element on all cells + * anyway. + * + * However, for hp objects + * (i.e. the hp::DoFHandler + * class), different finite + * element objects may be used on + * different cells. On faces + * between two cells, as well as + * vertices, there may therefore + * be two sets of degrees of + * freedom, one for each of the + * finite elements used on the + * adjacent cells. In order to + * specify which set of degrees + * of freedom to work on, the + * last argument is used to + * disambiguate. Finally, if this + * function is called for a cell + * object, there can only be a + * single set of degrees of + * freedom, and fe_index has to + * match the result of + * active_fe_index(). + */ + unsigned int vertex_dof_index (const unsigned int vertex, + const unsigned int i, + const unsigned int fe_index = DH::default_fe_index) const; + + /** + * Set the index of the i degree + * on the @p vertexth vertex to @p index. + * + * The last argument denotes the + * finite element index. For the + * standard ::DoFHandler class, + * this value must be equal to + * its default value since that + * class only supports the same + * finite element on all cells + * anyway. + * + * However, for hp objects + * (i.e. the hp::DoFHandler + * class), different finite + * element objects may be used on + * different cells. On faces + * between two cells, as well as + * vertices, there may therefore + * be two sets of degrees of + * freedom, one for each of the + * finite elements used on the + * adjacent cells. In order to + * specify which set of degrees + * of freedom to work on, the + * last argument is used to + * disambiguate. Finally, if this + * function is called for a cell + * object, there can only be a + * single set of degrees of + * freedom, and fe_index has to + * match the result of + * active_fe_index(). + */ + void set_vertex_dof_index (const unsigned int vertex, + const unsigned int i, + const unsigned int index, + const unsigned int fe_index = DH::default_fe_index) const; + + /** + * Exceptions for child classes * * @ingroup Exceptions */ @@ -368,125 +494,6 @@ class DoFObjectAccessor : public DoFAccessor unsigned int dof_index (const unsigned int i, const unsigned int fe_index = DH::default_fe_index) const; - /** - * Set the index of the - * ith degree of freedom - * of this object to @p index. - * - * The last argument denotes the - * finite element index. For the - * standard ::DoFHandler class, - * this value must be equal to - * its default value since that - * class only supports the same - * finite element on all cells - * anyway. - * - * However, for hp objects - * (i.e. the hp::DoFHandler - * class), different finite - * element objects may be used on - * different cells. On faces - * between two cells, as well as - * vertices, there may therefore - * be two sets of degrees of - * freedom, one for each of the - * finite elements used on the - * adjacent cells. In order to - * specify which set of degrees - * of freedom to work on, the - * last argument is used to - * disambiguate. Finally, if this - * function is called for a cell - * object, there can only be a - * single set of degrees of - * freedom, and fe_index has to - * match the result of - * active_fe_index(). - */ - void set_dof_index (const unsigned int i, - const unsigned int index, - const unsigned int fe_index = DH::default_fe_index) const; - - /** - * Index of the i degree - * on the @p vertexth vertex. - * - * The last argument denotes the - * finite element index. For the - * standard ::DoFHandler class, - * this value must be equal to - * its default value since that - * class only supports the same - * finite element on all cells - * anyway. - * - * However, for hp objects - * (i.e. the hp::DoFHandler - * class), different finite - * element objects may be used on - * different cells. On faces - * between two cells, as well as - * vertices, there may therefore - * be two sets of degrees of - * freedom, one for each of the - * finite elements used on the - * adjacent cells. In order to - * specify which set of degrees - * of freedom to work on, the - * last argument is used to - * disambiguate. Finally, if this - * function is called for a cell - * object, there can only be a - * single set of degrees of - * freedom, and fe_index has to - * match the result of - * active_fe_index(). - */ - unsigned int vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index = DH::default_fe_index) const; - - /** - * Set the index of the i degree - * on the @p vertexth vertex to @p index. - * - * The last argument denotes the - * finite element index. For the - * standard ::DoFHandler class, - * this value must be equal to - * its default value since that - * class only supports the same - * finite element on all cells - * anyway. - * - * However, for hp objects - * (i.e. the hp::DoFHandler - * class), different finite - * element objects may be used on - * different cells. On faces - * between two cells, as well as - * vertices, there may therefore - * be two sets of degrees of - * freedom, one for each of the - * finite elements used on the - * adjacent cells. In order to - * specify which set of degrees - * of freedom to work on, the - * last argument is used to - * disambiguate. Finally, if this - * function is called for a cell - * object, there can only be a - * single set of degrees of - * freedom, and fe_index has to - * match the result of - * active_fe_index(). - */ - void set_vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int index, - const unsigned int fe_index = DH::default_fe_index) const; - /** * Return the indices of the dofs of this * object in the standard ordering: dofs @@ -574,15 +581,6 @@ class DoFObjectAccessor : public DoFAccessor */ TriaIterator > quad (const unsigned int i) const; - - /** - * ith child as a DoFObjectAccessor - * iterator. This function is needed since - * the child function of the base - * class returns a hex accessor without - * access to the DoF data. - */ - TriaIterator > child (const unsigned int) const; }; @@ -763,85 +761,6 @@ class DoFObjectAccessor<1, DH> : public DoFAccessor<1,DH> const unsigned int index, const unsigned int fe_index = DH::default_fe_index) const; - /** - * Index of the i degree - * on the @p vertexth vertex. - * - * The last argument denotes the - * finite element index. For the - * standard ::DoFHandler class, - * this value must be equal to - * its default value since that - * class only supports the same - * finite element on all cells - * anyway. - * - * However, for hp objects - * (i.e. the hp::DoFHandler - * class), different finite - * element objects may be used on - * different cells. On faces - * between two cells, as well as - * vertices, there may therefore - * be two sets of degrees of - * freedom, one for each of the - * finite elements used on the - * adjacent cells. In order to - * specify which set of degrees - * of freedom to work on, the - * last argument is used to - * disambiguate. Finally, if this - * function is called for a cell - * object, there can only be a - * single set of degrees of - * freedom, and fe_index has to - * match the result of - * active_fe_index(). - */ - unsigned int vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index = DH::default_fe_index) const; - - /** - * Set the index of the i degree - * on the @p vertexth vertex to @p index. - * - * The last argument denotes the - * finite element index. For the - * standard ::DoFHandler class, - * this value must be equal to - * its default value since that - * class only supports the same - * finite element on all cells - * anyway. - * - * However, for hp objects - * (i.e. the hp::DoFHandler - * class), different finite - * element objects may be used on - * different cells. On faces - * between two cells, as well as - * vertices, there may therefore - * be two sets of degrees of - * freedom, one for each of the - * finite elements used on the - * adjacent cells. In order to - * specify which set of degrees - * of freedom to work on, the - * last argument is used to - * disambiguate. Finally, if this - * function is called for a cell - * object, there can only be a - * single set of degrees of - * freedom, and fe_index has to - * match the result of - * active_fe_index(). - */ - void set_vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int index, - const unsigned int fe_index = DH::default_fe_index) const; - /** * Return the indices of the dofs of this * object in the standard ordering: dofs @@ -915,15 +834,6 @@ class DoFObjectAccessor<1, DH> : public DoFAccessor<1,DH> */ void get_dof_indices (std::vector &dof_indices, const unsigned int fe_index = DH::default_fe_index) const; - - /** - * Return the @p ith child as a DoF line - * iterator. This function is needed since - * the child function of the base - * class returns a line accessor without - * access to the DoF data. - */ - TriaIterator > child (const unsigned int) const; }; @@ -1049,85 +959,6 @@ class DoFObjectAccessor<2, DH> : public DoFAccessor<2,DH> const unsigned int index, const unsigned int fe_index = DH::default_fe_index) const; - /** - * Index of the i degree - * on the @p vertexth vertex. - * - * The last argument denotes the - * finite element index. For the - * standard ::DoFHandler class, - * this value must be equal to - * its default value since that - * class only supports the same - * finite element on all cells - * anyway. - * - * However, for hp objects - * (i.e. the hp::DoFHandler - * class), different finite - * element objects may be used on - * different cells. On faces - * between two cells, as well as - * vertices, there may therefore - * be two sets of degrees of - * freedom, one for each of the - * finite elements used on the - * adjacent cells. In order to - * specify which set of degrees - * of freedom to work on, the - * last argument is used to - * disambiguate. Finally, if this - * function is called for a cell - * object, there can only be a - * single set of degrees of - * freedom, and fe_index has to - * match the result of - * active_fe_index(). - */ - unsigned int vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index = DH::default_fe_index) const; - - /** - * Set the index of the i degree - * on the @p vertexth vertex to @p index. - * - * The last argument denotes the - * finite element index. For the - * standard ::DoFHandler class, - * this value must be equal to - * its default value since that - * class only supports the same - * finite element on all cells - * anyway. - * - * However, for hp objects - * (i.e. the hp::DoFHandler - * class), different finite - * element objects may be used on - * different cells. On faces - * between two cells, as well as - * vertices, there may therefore - * be two sets of degrees of - * freedom, one for each of the - * finite elements used on the - * adjacent cells. In order to - * specify which set of degrees - * of freedom to work on, the - * last argument is used to - * disambiguate. Finally, if this - * function is called for a cell - * object, there can only be a - * single set of degrees of - * freedom, and fe_index has to - * match the result of - * active_fe_index(). - */ - void set_vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int index, - const unsigned int fe_index = DH::default_fe_index) const; - /** * Return the indices of the dofs of this * object in the standard ordering: dofs @@ -1208,16 +1039,6 @@ class DoFObjectAccessor<2, DH> : public DoFAccessor<2,DH> */ TriaIterator > line (const unsigned int i) const; - - /** - * Return the @p ith child as a DoF quad - * iterator. This function is needed since - * the child function of the base - * class returns a quad accessor without - * access to the DoF data. - */ - TriaIterator > - child (const unsigned int) const; }; @@ -1344,85 +1165,6 @@ class DoFObjectAccessor<3, DH> : public DoFAccessor<3,DH> const unsigned int index, const unsigned int fe_index = DH::default_fe_index) const; - /** - * Index of the i degree - * on the @p vertexth vertex. - * - * The last argument denotes the - * finite element index. For the - * standard ::DoFHandler class, - * this value must be equal to - * its default value since that - * class only supports the same - * finite element on all cells - * anyway. - * - * However, for hp objects - * (i.e. the hp::DoFHandler - * class), different finite - * element objects may be used on - * different cells. On faces - * between two cells, as well as - * vertices, there may therefore - * be two sets of degrees of - * freedom, one for each of the - * finite elements used on the - * adjacent cells. In order to - * specify which set of degrees - * of freedom to work on, the - * last argument is used to - * disambiguate. Finally, if this - * function is called for a cell - * object, there can only be a - * single set of degrees of - * freedom, and fe_index has to - * match the result of - * active_fe_index(). - */ - unsigned int vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index = DH::default_fe_index) const; - - /** - * Set the index of the i degree - * on the @p vertexth vertex to @p index. - * - * The last argument denotes the - * finite element index. For the - * standard ::DoFHandler class, - * this value must be equal to - * its default value since that - * class only supports the same - * finite element on all cells - * anyway. - * - * However, for hp objects - * (i.e. the hp::DoFHandler - * class), different finite - * element objects may be used on - * different cells. On faces - * between two cells, as well as - * vertices, there may therefore - * be two sets of degrees of - * freedom, one for each of the - * finite elements used on the - * adjacent cells. In order to - * specify which set of degrees - * of freedom to work on, the - * last argument is used to - * disambiguate. Finally, if this - * function is called for a cell - * object, there can only be a - * single set of degrees of - * freedom, and fe_index has to - * match the result of - * active_fe_index(). - */ - void set_vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int index, - const unsigned int fe_index = DH::default_fe_index) const; - /** * Return the indices of the dofs of this * object in the standard ordering: dofs @@ -1510,15 +1252,6 @@ class DoFObjectAccessor<3, DH> : public DoFAccessor<3,DH> */ TriaIterator > quad (const unsigned int i) const; - - /** - * Return the @p ith child as a DoF hex - * iterator. This function is needed since - * the child function of the base - * class returns a hex accessor without - * access to the DoF data. - */ - TriaIterator > child (const unsigned int) const; }; @@ -1991,31 +1724,6 @@ template <> TriaIterator<3, DoFObjectAccessor<2,DoFHandler<3> > > DoFCellAccessor >::face (const unsigned int i) const; -template <> -void DoFObjectAccessor<1,hp::DoFHandler<1> >::set_dof_index (const unsigned int, - const unsigned int, - const unsigned int) const; -template <> -void DoFObjectAccessor<1,hp::DoFHandler<2> >::set_dof_index (const unsigned int, - const unsigned int, - const unsigned int) const; -template <> -void DoFObjectAccessor<1,hp::DoFHandler<3> >::set_dof_index (const unsigned int, - const unsigned int, - const unsigned int) const; -template <> -void DoFObjectAccessor<2,hp::DoFHandler<2> >::set_dof_index (const unsigned int, - const unsigned int, - const unsigned int) const; -template <> -void DoFObjectAccessor<2,hp::DoFHandler<3> >::set_dof_index (const unsigned int, - const unsigned int, - const unsigned int) const; -template <> -void DoFObjectAccessor<3,hp::DoFHandler<3> >::set_dof_index (const unsigned int, - const unsigned int, - const unsigned int) const; - template <> const FiniteElement<1> & 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 b88f02b6c7..2f4702ed62 100644 --- a/deal.II/deal.II/include/dofs/dof_accessor.templates.h +++ b/deal.II/deal.II/include/dofs/dof_accessor.templates.h @@ -118,6 +118,61 @@ DoFAccessor::operator != (const DoFAccessor &a) cons +template +inline +TriaIterator > +DoFAccessor::child (const unsigned int i) const +{ + Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), + ExcMessage ("DoFHandler not initialized")); + + TriaIterator > q (this->tria, + this->present_level+1, + this->child_index (i), + this->dof_handler); + + // make sure that we either created + // a past-the-end iterator or one + // pointing to a used cell + Assert ((q.state() == IteratorState::past_the_end) + || + q->used(), + typename TriaAccessor::ExcUnusedCellAsChild()); + + return q; +} + + + +template +inline +unsigned int +DoFAccessor::vertex_dof_index (const unsigned int vertex, + const unsigned int i, + const unsigned int fe_index) const +{ + return this->dof_handler->get_vertex_dof_index (this->vertex_index(vertex), + fe_index, + i); +} + + + +template +void DoFAccessor::set_vertex_dof_index (const unsigned int vertex, + const unsigned int i, + const unsigned int index, + const unsigned int fe_index) const +{ + this->dof_handler->set_vertex_dof_index (this->vertex_index(vertex), + fe_index, + i, + index); +} + + + + /*------------------------- Functions: DoFObjectAccessor<1,dim> -----------------------*/ @@ -135,27 +190,6 @@ DoFObjectAccessor (const Triangulation *tria, -template -inline -TriaIterator > -DoFObjectAccessor<1,DH>::child (const unsigned int i) const -{ - Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), - ExcMessage ("DoFHandler not initialized")); - - TriaIterator > q (this->tria, - this->present_level+1, - this->child_index (i), - this->dof_handler); - -#ifdef DEBUG - if (q.state() != IteratorState::past_the_end) - Assert (q->used(), typename TriaAccessor::ExcUnusedCellAsChild()); -#endif - return q; -} - - /*------------------------- Functions: DoFObjectAccessor<2,dim> -----------------------*/ @@ -192,28 +226,6 @@ DoFObjectAccessor<2,DH>::line (const unsigned int i) const -template -inline -TriaIterator > -DoFObjectAccessor<2,DH>::child (const unsigned int i) const -{ - Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), - ExcMessage ("DoFHandler not initialized")); - - TriaIterator > q (this->tria, - this->present_level+1, - this->child_index (i), - this->dof_handler); - -#ifdef DEBUG - if (q.state() != IteratorState::past_the_end) - Assert (q->used(), typename TriaAccessor::ExcUnusedCellAsChild()); -#endif - return q; -} - - - /*------------------------- Functions: DoFObjectAccessor<3,dim> -----------------------*/ template @@ -262,24 +274,6 @@ DoFObjectAccessor<3,DH>::quad (const unsigned int i) const } -template -inline -TriaIterator > -DoFObjectAccessor<3,DH>::child (const unsigned int i) const -{ - TriaIterator > q (this->tria, - this->present_level+1, - this->child_index (i), - this->dof_handler); - -#ifdef DEBUG - if (q.state() != IteratorState::past_the_end) - Assert (q->used(), typename TriaAccessor::ExcUnusedCellAsChild()); -#endif - return q; -} - - /*--------------- Functions: DoFObjectAccessor<1,DoFHandler> -----------*/ @@ -307,32 +301,6 @@ DoFObjectAccessor<1,DoFHandler<1> >::dof_index (const unsigned int i, -template <> -inline -unsigned int -DoFObjectAccessor<1,DoFHandler<1> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index) const -{ - Assert (fe_index == DoFHandler<1>::default_fe_index, - ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); - Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), - ExcMessage ("DoFHandler not initialized")); - - Assert (this->dof_handler != 0, BaseClass::ExcInvalidObject()); - Assert (&this->dof_handler->get_fe() != 0, BaseClass::ExcInvalidObject()); - Assert (vertex<2, ExcIndexRange (i,0,2)); - Assert (idof_handler->get_fe().dofs_per_vertex, - ExcIndexRange (i, 0, this->dof_handler->get_fe().dofs_per_vertex)); - - const unsigned int dof_number = (this->vertex_index(vertex) * - this->dof_handler->get_fe().dofs_per_vertex + - i); - return this->dof_handler->vertex_dofs[dof_number]; -} - - - template <> inline void @@ -368,7 +336,7 @@ DoFObjectAccessor<1,DoFHandler<1> >::get_dof_indices (std::vector std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<2; ++vertex) for (unsigned int d=0; dvertex_dof_index(vertex,d); for (unsigned int d=0; d >::dof_index (const unsigned int i, -template <> -inline -unsigned int -DoFObjectAccessor<1,DoFHandler<2> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index) const -{ - Assert (fe_index == DoFHandler<2>::default_fe_index, - ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); - Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), - ExcMessage ("DoFHandler not initialized")); - - Assert (this->dof_handler != 0, BaseClass::ExcInvalidObject()); - Assert (&this->dof_handler->get_fe() != 0, BaseClass::ExcInvalidObject()); - Assert (vertex<2, ExcIndexRange (i,0,2)); - Assert (idof_handler->get_fe().dofs_per_vertex, - ExcIndexRange (i, 0, this->dof_handler->get_fe().dofs_per_vertex)); - - const unsigned int dof_number = (this->vertex_index(vertex) * - this->dof_handler->get_fe().dofs_per_vertex + - i); - return this->dof_handler->vertex_dofs[dof_number]; -} - - - template <> inline void @@ -460,7 +402,7 @@ DoFObjectAccessor<1,DoFHandler<2> >::get_dof_indices (std::vector std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<2; ++vertex) for (unsigned int d=0; dvertex_dof_index(vertex,d); for (unsigned int d=0; d >::dof_index (const unsigned int i, -template <> -inline -unsigned int -DoFObjectAccessor<1,DoFHandler<3> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index) const -{ - Assert (fe_index == DoFHandler<3>::default_fe_index, - ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); - Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), - ExcMessage ("DoFHandler not initialized")); - - Assert (this->dof_handler != 0, BaseClass::ExcInvalidObject()); - Assert (&this->dof_handler->get_fe() != 0, BaseClass::ExcInvalidObject()); - Assert (vertex<2, ExcIndexRange (i,0,2)); - Assert (idof_handler->get_fe().dofs_per_vertex, - ExcIndexRange (i, 0, this->dof_handler->get_fe().dofs_per_vertex)); - - const unsigned int dof_number = (this->vertex_index(vertex) * - this->dof_handler->get_fe().dofs_per_vertex + - i); - return this->dof_handler->vertex_dofs[dof_number]; -} - - - template <> inline void @@ -552,7 +468,7 @@ DoFObjectAccessor<1,DoFHandler<3> >::get_dof_indices (std::vector std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<2; ++vertex) for (unsigned int d=0; dvertex_dof_index(vertex,d); for (unsigned int d=0; d >::dof_index (const unsigned int i, -template <> -inline -unsigned int -DoFObjectAccessor<2,DoFHandler<2> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index) const -{ - Assert (fe_index == DoFHandler<2>::default_fe_index, - ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); - Assert (this->dof_handler != 0, - BaseClass::ExcInvalidObject()); - Assert (&this->dof_handler->get_fe() != 0, - BaseClass::ExcInvalidObject()); - Assert (vertex<4, ExcIndexRange (i,0,4)); - Assert (idof_handler->get_fe().dofs_per_vertex, - ExcIndexRange (i, 0, this->dof_handler->get_fe().dofs_per_vertex)); - Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), - ExcMessage ("DoFHandler not initialized")); - - const unsigned int dof_number = (this->vertex_index(vertex) * - this->dof_handler->get_fe().dofs_per_vertex + - i); - return this->dof_handler->vertex_dofs[dof_number]; -} - - - template <> inline void @@ -652,7 +541,7 @@ DoFObjectAccessor<2,DoFHandler<2> >::get_dof_indices (std::vector std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<4; ++vertex) for (unsigned int d=0; dvertex_dof_index(vertex,d); for (unsigned int line=0; line<4; ++line) for (unsigned int d=0; dline(line)->dof_index(d); @@ -687,33 +576,6 @@ DoFObjectAccessor<2,DoFHandler<3> >::dof_index (const unsigned int i, -template <> -inline -unsigned int -DoFObjectAccessor<2,DoFHandler<3> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index) const -{ - Assert (fe_index == DoFHandler<3>::default_fe_index, - ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); - Assert (this->dof_handler != 0, - BaseClass::ExcInvalidObject()); - Assert (&this->dof_handler->get_fe() != 0, - BaseClass::ExcInvalidObject()); - Assert (vertex<4, ExcIndexRange (i,0,4)); - Assert (idof_handler->get_fe().dofs_per_vertex, - ExcIndexRange (i, 0, this->dof_handler->get_fe().dofs_per_vertex)); - Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), - ExcMessage ("DoFHandler not initialized")); - - const unsigned int dof_number = (this->vertex_index(vertex) * - this->dof_handler->get_fe().dofs_per_vertex + - i); - return this->dof_handler->vertex_dofs[dof_number]; -} - - - template <> inline void @@ -753,7 +615,7 @@ DoFObjectAccessor<2,DoFHandler<3> >::get_dof_indices (std::vector std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<4; ++vertex) for (unsigned int d=0; dvertex_dof_index(vertex,d); for (unsigned int line=0; line<4; ++line) for (unsigned int d=0; dline(line)->dof_index(d); @@ -793,33 +655,6 @@ DoFObjectAccessor<3,DoFHandler<3> >::dof_index (const unsigned int i, -template <> -inline -unsigned int -DoFObjectAccessor<3,DoFHandler<3> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index) const -{ - Assert (fe_index == DoFHandler<3>::default_fe_index, - ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); - Assert (this->dof_handler != 0, - BaseClass::ExcInvalidObject()); - Assert (&this->dof_handler->get_fe() != 0, - BaseClass::ExcInvalidObject()); - Assert (vertex<8, ExcIndexRange (i,0,8)); - Assert (idof_handler->get_fe().dofs_per_vertex, - ExcIndexRange (i, 0, this->dof_handler->get_fe().dofs_per_vertex)); - Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), - ExcMessage ("DoFHandler not initialized")); - - const unsigned int dof_number = (this->vertex_index(vertex) * - this->dof_handler->get_fe().dofs_per_vertex + - i); - return this->dof_handler->vertex_dofs[dof_number]; -} - - - template <> inline void @@ -862,7 +697,7 @@ DoFObjectAccessor<3,DoFHandler<3> >::get_dof_indices (std::vector std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<8; ++vertex) for (unsigned int d=0; dvertex_dof_index(vertex,d); for (unsigned int line=0; line<12; ++line) for (unsigned int d=0; dline(line)->dof_index(d); @@ -877,98 +712,6 @@ DoFObjectAccessor<3,DoFHandler<3> >::get_dof_indices (std::vector /* -------------- hp vertex dofs stuff ------------------------------------ */ -template <> -inline -unsigned int -DoFObjectAccessor<1,hp::DoFHandler<1> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index) const -{ - return internal::hp::DoFLevel<0>:: - get_vertex_dof_index (*this->dof_handler, - this->vertex_index(vertex), - fe_index, - i); -} - - - -template <> -inline -unsigned int -DoFObjectAccessor<1,hp::DoFHandler<2> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index) const -{ - return internal::hp::DoFLevel<0>:: - get_vertex_dof_index (*this->dof_handler, - this->vertex_index(vertex), - fe_index, - i); -} - - -template <> -inline -unsigned int -DoFObjectAccessor<1,hp::DoFHandler<3> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index) const -{ - return internal::hp::DoFLevel<0>:: - get_vertex_dof_index (*this->dof_handler, - this->vertex_index(vertex), - fe_index, - i); -} - - -template <> -inline -unsigned int -DoFObjectAccessor<2,hp::DoFHandler<2> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index) const -{ - return internal::hp::DoFLevel<0>:: - get_vertex_dof_index (*this->dof_handler, - this->vertex_index(vertex), - fe_index, - i); -} - - - -template <> -inline -unsigned int -DoFObjectAccessor<2,hp::DoFHandler<3> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index) const -{ - return internal::hp::DoFLevel<0>:: - get_vertex_dof_index (*this->dof_handler, - this->vertex_index(vertex), - fe_index, - i); -} - - - -template <> -inline -unsigned int -DoFObjectAccessor<3,hp::DoFHandler<3> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index) const -{ - return internal::hp::DoFLevel<0>:: - get_vertex_dof_index (*this->dof_handler, - this->vertex_index(vertex), - fe_index, - i); -} - /*--------------- Functions: DoFObjectAccessor<1,hp::DoFHandler> -----------*/ @@ -1020,7 +763,7 @@ DoFObjectAccessor<1,hp::DoFHandler<1> >::get_dof_indices (std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<2; ++vertex) for (unsigned int d=0; dvertex_dof_index(vertex,d,fe_index); for (unsigned int d=0; d >::get_dof_indices (std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<2; ++vertex) for (unsigned int d=0; dvertex_dof_index(vertex,d,fe_index); for (unsigned int d=0; d >::get_dof_indices (std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<2; ++vertex) for (unsigned int d=0; dvertex_dof_index(vertex,d,fe_index); for (unsigned int d=0; d >::get_dof_indices (std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<4; ++vertex) for (unsigned int d=0; dvertex_dof_index(vertex,d,fe_index); for (unsigned int line=0; line<4; ++line) for (unsigned int d=0; dline(line)->dof_index(d,fe_index); @@ -1337,7 +1080,7 @@ DoFObjectAccessor<2,hp::DoFHandler<3> >::get_dof_indices (std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<4; ++vertex) for (unsigned int d=0; dvertex_dof_index(vertex,d,fe_index); for (unsigned int line=0; line<4; ++line) for (unsigned int d=0; dline(line)->dof_index(d,fe_index); @@ -1423,7 +1166,7 @@ DoFObjectAccessor<3,hp::DoFHandler<3> >::get_dof_indices (std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<8; ++vertex) for (unsigned int d=0; dvertex_dof_index(vertex,d,fe_index); for (unsigned int line=0; line<12; ++line) for (unsigned int d=0; dline(line)->dof_index(d,fe_index); diff --git a/deal.II/deal.II/include/dofs/dof_handler.h b/deal.II/deal.II/include/dofs/dof_handler.h index 8353b7df5b..2d66793722 100644 --- a/deal.II/deal.II/include/dofs/dof_handler.h +++ b/deal.II/deal.II/include/dofs/dof_handler.h @@ -1048,6 +1048,77 @@ class DoFHandler : public Subscriptor unsigned int distribute_dofs_on_cell (active_cell_iterator &cell, unsigned int next_free_dof); + /** + * Set the @p local_index-th + * degree of freedom + * corresponding to the finite + * element specified by @p + * fe_index on the vertex with + * global number @p + * vertex_index to @p + * global_index. + * + * This function is needed by + * DoFAccessor::set_vertex_dof_index + * when distributing degrees of + * freedom on a mesh. + * + * Since here we are dealing + * with a non-hp finite element + * DoF handler, the only + * reasonable choice for + * fe_index is + * default_fe_index. All other + * values will be ignored. The + * parameter to this function + * exists nevertheless to make + * sure that the accessor + * classes can be templatized + * on the type of the DoF + * handler. + */ + void + set_vertex_dof_index (const unsigned int vertex_index, + const unsigned int fe_index, + const unsigned int local_index, + const unsigned int global_index); + + /** + * Get the @p local_index-th + * degree of freedom + * corresponding to the finite + * element specified by @p + * fe_index on the vertex with + * global number @p + * vertex_index to @p + * global_index. + * + * This function is needed by + * DoFAccessor::vertex_dof_index, + * which in turn is called for + * example when doing things + * like + * cell-@>get_dof_indices(). + * + * Since here we are dealing + * with a non-hp finite element + * DoF handler, the only + * reasonable choice for + * fe_index is + * default_fe_index. All other + * values will be ignored. The + * parameter to this function + * exists nevertheless to make + * sure that the accessor + * classes can be templatized + * on the type of the DoF + * handler. + */ + unsigned int + get_vertex_dof_index (const unsigned int vertex_index, + const unsigned int fe_index, + const unsigned int local_index) const; + /** * Space to store the DoF numbers for the * different levels. Analogous to the @@ -1240,6 +1311,51 @@ DoFHandler::get_tria () const } + +template +inline +unsigned int +DoFHandler:: +get_vertex_dof_index (const unsigned int vertex_index, + const unsigned int fe_index, + const unsigned int local_index) const +{ + Assert (fe_index == DoFHandler::default_fe_index, + ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); + Assert (selected_fe != 0, + ExcMessage ("No finite element collection is associated with " + "this DoFHandler")); + Assert (local_index < selected_fe->dofs_per_vertex, + ExcIndexRange(local_index, 0, + selected_fe->dofs_per_vertex)); + + return vertex_dofs[vertex_index * selected_fe->dofs_per_vertex + local_index]; +} + + + +template +inline +void +DoFHandler:: +set_vertex_dof_index (const unsigned int vertex_index, + const unsigned int fe_index, + const unsigned int local_index, + const unsigned int global_index) +{ + Assert (fe_index == DoFHandler::default_fe_index, + ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); + Assert (selected_fe != 0, + ExcMessage ("No finite element collection is associated with " + "this DoFHandler")); + Assert (local_index < selected_fe->dofs_per_vertex, + ExcIndexRange(local_index, 0, + selected_fe->dofs_per_vertex)); + + vertex_dofs[vertex_index * selected_fe->dofs_per_vertex + local_index] = global_index; +} + + #endif // DOXYGEN /*---------------------------- dof_handler.h ---------------------------*/ 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 19c42f9e83..c8ed3ddd33 100644 --- a/deal.II/deal.II/include/dofs/hp_dof_handler.h +++ b/deal.II/deal.II/include/dofs/hp_dof_handler.h @@ -1004,10 +1004,51 @@ namespace hp * active_fe_fields during the * spatial refinement. */ - virtual void pre_refinement_notification (const Triangulation &tria); virtual void post_refinement_notification (const Triangulation &tria); + /** + * Set the @p local_index-th + * degree of freedom + * corresponding to the finite + * element specified by @p + * fe_index on the vertex with + * global number @p + * vertex_index to @p + * global_index. + * + * This function is needed by + * DoFAccessor::set_vertex_dof_index + * when distributing degrees of + * freedom on a mesh. + */ + void + set_vertex_dof_index (const unsigned int vertex_index, + const unsigned int fe_index, + const unsigned int local_index, + const unsigned int global_index); + + /** + * Get the @p local_index-th + * degree of freedom + * corresponding to the finite + * element specified by @p + * fe_index on the vertex with + * global number @p + * vertex_index to @p + * global_index. + * + * This function is needed by + * DoFAccessor::vertex_dof_index, + * which in turn is called for + * example when doing things + * like + * cell-@>get_dof_indices(). + */ + unsigned int + get_vertex_dof_index (const unsigned int vertex_index, + const unsigned int fe_index, + const unsigned int local_index) const; /** * Space to store the DoF @@ -1239,6 +1280,90 @@ namespace hp return *tria; } + + + template + inline + unsigned int + DoFHandler:: + get_vertex_dof_index (const unsigned int vertex_index, + const unsigned int fe_index, + const unsigned int local_index) const + { + Assert (fe_index != ::hp::DoFHandler::default_fe_index, + ExcMessage ("You need to specify a FE index when working " + "with hp DoFHandlers")); + Assert (finite_elements != 0, + ExcMessage ("No finite element collection is associated with " + "this DoFHandler")); + Assert (local_index < (*finite_elements)[fe_index].dofs_per_vertex, + ExcIndexRange(local_index, 0, + (*finite_elements)[fe_index].dofs_per_vertex)); + + // hop along the list of index + // sets until we find the one + // with the correct fe_index, and + // then poke into that + // part. trigger an exception if + // we can't find a set for this + // particular fe_index + const unsigned int starting_offset = vertex_dofs_offsets[vertex_index]; + const unsigned int *pointer = &vertex_dofs[starting_offset]; + while (true) + { + Assert (*pointer != deal_II_numbers::invalid_unsigned_int, + ExcInternalError()); + if (*pointer == fe_index) + return *(pointer + 1 + local_index); + else + pointer += (*finite_elements)[*pointer].dofs_per_vertex; + } + } + + + + template + inline + void + DoFHandler:: + set_vertex_dof_index (const unsigned int vertex_index, + const unsigned int fe_index, + const unsigned int local_index, + const unsigned int global_index) + { + Assert (fe_index != ::hp::DoFHandler::default_fe_index, + ExcMessage ("You need to specify a FE index when working " + "with hp DoFHandlers")); + Assert (finite_elements != 0, + ExcMessage ("No finite element collection is associated with " + "this DoFHandler")); + Assert (local_index < (*finite_elements)[fe_index].dofs_per_vertex, + ExcIndexRange(local_index, 0, + (*finite_elements)[fe_index].dofs_per_vertex)); + + // hop along the list of index + // sets until we find the one + // with the correct fe_index, and + // then poke into that + // part. trigger an exception if + // we can't find a set for this + // particular fe_index + const unsigned int starting_offset = vertex_dofs_offsets[vertex_index]; + unsigned int *pointer = &vertex_dofs[starting_offset]; + while (true) + { + Assert (*pointer != deal_II_numbers::invalid_unsigned_int, + ExcInternalError()); + if (*pointer == fe_index) + { + *(pointer + 1 + local_index) = global_index; + return; + } + else + pointer += (*finite_elements)[*pointer].dofs_per_vertex; + } + } + #endif } diff --git a/deal.II/deal.II/include/dofs/hp_dof_levels.h b/deal.II/deal.II/include/dofs/hp_dof_levels.h index 3b8f6b8dea..42fc106fad 100644 --- a/deal.II/deal.II/include/dofs/hp_dof_levels.h +++ b/deal.II/deal.II/include/dofs/hp_dof_levels.h @@ -85,23 +85,6 @@ namespace internal */ std::vector active_fe_indices; - - template - static - void - set_vertex_dof_index (::hp::DoFHandler &dof_handler, - const unsigned int vertex_index, - const unsigned int fe_index, - const unsigned int local_index, - const unsigned int global_index); - - template - static - unsigned int - get_vertex_dof_index (const ::hp::DoFHandler &dof_handler, - const unsigned int vertex_index, - const unsigned int fe_index, - const unsigned int local_index); }; diff --git a/deal.II/deal.II/source/dofs/dof_accessor.cc b/deal.II/deal.II/source/dofs/dof_accessor.cc index c95bf0490b..e18099bb2c 100644 --- a/deal.II/deal.II/source/dofs/dof_accessor.cc +++ b/deal.II/deal.II/source/dofs/dof_accessor.cc @@ -58,32 +58,6 @@ void DoFObjectAccessor<1, DH>::set_dof_index (const unsigned int i, - -template -void DoFObjectAccessor<1, DH>::set_vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int index, - const unsigned int fe_index) const - -{ - Assert (fe_index == DoFHandler<1>::default_fe_index, - ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); - Assert (this->dof_handler != 0, - typename BaseClass::ExcInvalidObject()); - Assert (&this->dof_handler->get_fe() != 0, - typename BaseClass::ExcInvalidObject()); - Assert (vertex<2, ExcIndexRange (i,0,2)); - Assert (idof_handler->get_fe().dofs_per_vertex, - ExcIndexRange (i, 0, this->dof_handler->get_fe().dofs_per_vertex)); - - const unsigned int dof_number = (this->vertex_index(vertex) * - this->dof_handler->get_fe().dofs_per_vertex + - i); - this->dof_handler->vertex_dofs[dof_number] = index; -} - - - /*------------------------- Functions: DoFObjectAccessor<2,dim> -----------------------*/ @@ -109,29 +83,6 @@ void DoFObjectAccessor<2, DH>::set_dof_index (const unsigned int i, -template -void -DoFObjectAccessor<2, DH>::set_vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int index, - const unsigned int fe_index) const -{ - Assert (fe_index == DoFHandler<1>::default_fe_index, - ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); - Assert (this->dof_handler != 0, - typename BaseClass::ExcInvalidObject()); - Assert (&this->dof_handler->get_fe() != 0, - typename BaseClass::ExcInvalidObject()); - Assert (vertex<4, ExcIndexRange (i,0,4)); - Assert (idof_handler->get_fe().dofs_per_vertex, - ExcIndexRange (i, 0, this->dof_handler->get_fe().dofs_per_vertex)); - - const unsigned int dof_number = (this->vertex_index(vertex) * - this->dof_handler->get_fe().dofs_per_vertex + - i); - this->dof_handler->vertex_dofs[dof_number] = index; -} - /*------------------------- Functions: DoFObjectAccessor<3,dim> -----------------------*/ @@ -158,142 +109,6 @@ void DoFObjectAccessor<3, DH>::set_dof_index (const unsigned int i, } - -template -void DoFObjectAccessor<3, DH>::set_vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int index, - const unsigned int fe_index) const -{ - Assert (fe_index == DoFHandler<1>::default_fe_index, - ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); - Assert (this->dof_handler != 0, - typename BaseClass::ExcInvalidObject()); - Assert (&this->dof_handler->get_fe() != 0, - typename BaseClass::ExcInvalidObject()); - Assert (vertex<8, - ExcIndexRange (i,0,8)); - Assert (idof_handler->get_fe().dofs_per_vertex, - ExcIndexRange (i, 0, this->dof_handler->get_fe().dofs_per_vertex)); - - const unsigned int dof_number = (this->vertex_index(vertex) * - this->dof_handler->get_fe().dofs_per_vertex + - i); - this->dof_handler->vertex_dofs[dof_number] = index; -} - - - - -// --------------- hp::DoFHandler specializations for 1d objects ----------- - - -#if deal_II_dimension == 1 - -template <> -void DoFObjectAccessor<1, hp::DoFHandler<1> >::set_vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int index, - const unsigned int fe_index) const -{ - internal::hp::DoFLevel<0>::set_vertex_dof_index (*this->dof_handler, - this->vertex_index(vertex), - fe_index, - i, - index); -} - - -#endif - - - - -// --------------- hp::DoFHandler specializations for 2d objects ----------- - - - -#if deal_II_dimension == 2 - -template <> -void DoFObjectAccessor<1, hp::DoFHandler<2> >::set_vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int index, - const unsigned int fe_index) const -{ - internal::hp::DoFLevel<0>::set_vertex_dof_index (*this->dof_handler, - this->vertex_index(vertex), - fe_index, - i, - index); -} - -template <> -void DoFObjectAccessor<2, hp::DoFHandler<2> >::set_vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int index, - const unsigned int fe_index) const -{ - internal::hp::DoFLevel<0>::set_vertex_dof_index (*this->dof_handler, - this->vertex_index(vertex), - fe_index, - i, - index); -} - - -#endif - - - -// --------------- hp::DoFHandler specializations for 3d objects ----------- - -#if deal_II_dimension == 3 - -template <> -void DoFObjectAccessor<1, hp::DoFHandler<3> >::set_vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int index, - const unsigned int fe_index) const -{ - internal::hp::DoFLevel<0>::set_vertex_dof_index (*this->dof_handler, - this->vertex_index(vertex), - fe_index, - i, - index); -} - -template <> -void DoFObjectAccessor<2, hp::DoFHandler<3> >::set_vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int index, - const unsigned int fe_index) const -{ - internal::hp::DoFLevel<0>::set_vertex_dof_index (*this->dof_handler, - this->vertex_index(vertex), - fe_index, - i, - index); -} - - -template <> -void DoFObjectAccessor<3, hp::DoFHandler<3> >::set_vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int index, - const unsigned int fe_index) const -{ - internal::hp::DoFLevel<0>::set_vertex_dof_index (*this->dof_handler, - this->vertex_index(vertex), - fe_index, - i, - index); -} - - -#endif - - /*------------------------- Functions: DoFCellAccessor -----------------------*/ diff --git a/deal.II/deal.II/source/dofs/hp_dof_levels.cc b/deal.II/deal.II/source/dofs/hp_dof_levels.cc index a03584683b..aefa556a6f 100644 --- a/deal.II/deal.II/source/dofs/hp_dof_levels.cc +++ b/deal.II/deal.II/source/dofs/hp_dof_levels.cc @@ -48,99 +48,7 @@ namespace internal MemoryConsumption::memory_consumption (hex_dofs) + MemoryConsumption::memory_consumption (dof_hex_index_offset)); } - - - - template - unsigned int - DoFLevel<0>:: - get_vertex_dof_index (const ::hp::DoFHandler &dof_handler, - const unsigned int vertex_index, - const unsigned int fe_index, - const unsigned int local_index) - { - Assert (fe_index != ::hp::DoFHandler::default_fe_index, - ExcMessage ("You need to specify a FE index when working " - "with hp DoFHandlers")); - Assert (&dof_handler != 0, - ExcMessage ("No DoFHandler is specified for this iterator")); - Assert (&dof_handler.get_fe() != 0, - ExcMessage ("No finite element collection is associated with " - "this DoFHandler")); - Assert (local_index < dof_handler.get_fe()[fe_index].dofs_per_vertex, - ExcIndexRange(local_index, 0, - dof_handler.get_fe()[fe_index].dofs_per_vertex)); - - // hop along the list of index - // sets until we find the one - // with the correct fe_index, and - // then poke into that - // part. trigger an exception if - // we can't find a set for this - // particular fe_index - const unsigned int starting_offset - = dof_handler.vertex_dofs_offsets[vertex_index]; - const unsigned int *pointer - = &dof_handler.vertex_dofs[starting_offset]; - while (true) - { - Assert (*pointer != deal_II_numbers::invalid_unsigned_int, - ExcInternalError()); - if (*pointer == fe_index) - return *(pointer + 1 + local_index); - else - pointer += dof_handler.get_fe()[*pointer].dofs_per_vertex; - } - } - - - - template - void - DoFLevel<0>:: - set_vertex_dof_index (::hp::DoFHandler &dof_handler, - const unsigned int vertex_index, - const unsigned int fe_index, - const unsigned int local_index, - const unsigned int global_index) - { - Assert (fe_index != ::hp::DoFHandler::default_fe_index, - ExcMessage ("You need to specify a FE index when working " - "with hp DoFHandlers")); - Assert (&dof_handler != 0, - ExcMessage ("No DoFHandler is specified for this iterator")); - Assert (&dof_handler.get_fe() != 0, - ExcMessage ("No finite element collection is associated with " - "this DoFHandler")); - Assert (local_index < dof_handler.get_fe()[fe_index].dofs_per_vertex, - ExcIndexRange(local_index, 0, - dof_handler.get_fe()[fe_index].dofs_per_vertex)); - - // hop along the list of index - // sets until we find the one - // with the correct fe_index, and - // then poke into that - // part. trigger an exception if - // we can't find a set for this - // particular fe_index - const unsigned int starting_offset - = dof_handler.vertex_dofs_offsets[vertex_index]; - unsigned int *pointer - = &dof_handler.vertex_dofs[starting_offset]; - while (true) - { - Assert (*pointer != deal_II_numbers::invalid_unsigned_int, - ExcInternalError()); - if (*pointer == fe_index) - { - *(pointer + 1 + local_index) = global_index; - return; - } - else - pointer += dof_handler.get_fe()[*pointer].dofs_per_vertex; - } - } @@ -539,23 +447,6 @@ namespace internal // explicit instantiations - template - unsigned int - DoFLevel<0>:: - get_vertex_dof_index (const ::hp::DoFHandler &dof_handler, - const unsigned int vertex_index, - const unsigned int fe_index, - const unsigned int local_index); - - template - void - DoFLevel<0>:: - set_vertex_dof_index (::hp::DoFHandler &dof_handler, - const unsigned int vertex_index, - const unsigned int fe_index, - const unsigned int local_index, - const unsigned int global_index); - template unsigned int DoFLevel<1>:: -- 2.39.5