From: Wolfgang Bangerth Date: Thu, 27 Apr 2006 16:03:55 +0000 (+0000) Subject: Add fe_index to functions that need to distinguish between different finite elements... X-Git-Tag: v8.0.0~11848 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b676b9652982f26b07b529f138054fba5995eac;p=dealii.git Add fe_index to functions that need to distinguish between different finite elements in the hp case. git-svn-id: https://svn.dealii.org/trunk@12924 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/dofs/dof_accessor.h b/deal.II/deal.II/include/dofs/dof_accessor.h index 80f0967a7c..88bb9bd59b 100644 --- a/deal.II/deal.II/include/dofs/dof_accessor.h +++ b/deal.II/deal.II/include/dofs/dof_accessor.h @@ -296,30 +296,159 @@ class DoFObjectAccessor : public DoFAccessor, /** * Index of the ith degree * of freedom of this object. - */ - unsigned int dof_index (const unsigned int i) const; + * + * 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 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. + * 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 int index) const; + 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; + 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; + const unsigned int index, + const unsigned int fe_index = DH::default_fe_index) const; /** * Return the indices of the dofs of this @@ -570,32 +699,161 @@ class DoFObjectAccessor<1, DH> : const AccessorData *local_data); /** - * Return the index of the @p ith degree - * of freedom of this line. - */ - unsigned int dof_index (const unsigned int i) const; + * Index of the ith degree + * of freedom of this object. + * + * 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 dof_index (const unsigned int i, + const unsigned int fe_index = DH::default_fe_index) const; /** - * Set the index of the @p ith degree - * of freedom of this line to @p index. + * 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; + const unsigned int index, + const unsigned int fe_index = DH::default_fe_index) const; /** - * Return the index of the @p ith degree + * 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; + const unsigned int i, + const unsigned int fe_index = DH::default_fe_index) const; /** - * Set the index of the @p ith degree + * 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; + const unsigned int index, + const unsigned int fe_index = DH::default_fe_index) const; /** * Return the indices of the dofs of this @@ -772,32 +1030,161 @@ class DoFObjectAccessor<2, DH> : const AccessorData *local_data); /** - * Return the index of the @p ith degree - * of freedom of this quad. - */ - unsigned int dof_index (const unsigned int i) const; + * Index of the ith degree + * of freedom of this object. + * + * 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 dof_index (const unsigned int i, + const unsigned int fe_index = DH::default_fe_index) const; /** - * Set the index of the @p ith degree - * of freedom of this quad to @p index. + * 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; + const unsigned int index, + const unsigned int fe_index = DH::default_fe_index) const; /** - * Return the index of the @p ith degree + * 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; + const unsigned int i, + const unsigned int fe_index = DH::default_fe_index) const; /** - * Set the index of the @p ith degree + * 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; + const unsigned int index, + const unsigned int fe_index = DH::default_fe_index) const; /** * Return the indices of the dofs of this @@ -982,33 +1369,163 @@ class DoFObjectAccessor<3, DH> : const int index, const AccessorData *local_data); + /** - * Return the index of the @p ith degree - * of freedom of this hex. - */ - unsigned int dof_index (const unsigned int i) const; + * Index of the ith degree + * of freedom of this object. + * + * 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 dof_index (const unsigned int i, + const unsigned int fe_index = DH::default_fe_index) const; /** - * Set the index of the @p ith degree - * of freedom of this hex to @p index. + * 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; + const unsigned int index, + const unsigned int fe_index = DH::default_fe_index) const; /** - * Return the index of the @p ith degree + * 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; + const unsigned int i, + const unsigned int fe_index = DH::default_fe_index) const; /** - * Set the index of the @p ith degree + * 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; + const unsigned int index, + const unsigned int fe_index = DH::default_fe_index) const; /** * Return the indices of the dofs of this @@ -1549,21 +2066,27 @@ 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; 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 9552b1007d..66983c758b 100644 --- a/deal.II/deal.II/include/dofs/dof_accessor.templates.h +++ b/deal.II/deal.II/include/dofs/dof_accessor.templates.h @@ -39,7 +39,8 @@ DoFAccessor::DoFAccessor () template inline -DoFAccessor::DoFAccessor (const DH *dof_handler) : +DoFAccessor::DoFAccessor (const DH *dof_handler) + : dof_handler(const_cast(dof_handler)) {} @@ -382,8 +383,11 @@ DoFObjectAccessor<3,DH>::operator != (const DoFObjectAccessor<3,DH> &a) const template <> inline unsigned int -DoFObjectAccessor<1,DoFHandler<1> >::dof_index (const unsigned int i) const +DoFObjectAccessor<1,DoFHandler<1> >::dof_index (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")); @@ -404,8 +408,11 @@ template <> inline unsigned int DoFObjectAccessor<1,DoFHandler<1> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i) const + 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")); @@ -465,8 +472,11 @@ DoFObjectAccessor<1,DoFHandler<1> >::get_dof_indices (std::vector template <> inline unsigned int -DoFObjectAccessor<1,DoFHandler<2> >::dof_index (const unsigned int i) const +DoFObjectAccessor<1,DoFHandler<2> >::dof_index (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")); @@ -487,8 +497,11 @@ template <> inline unsigned int DoFObjectAccessor<1,DoFHandler<2> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i) const + 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")); @@ -548,8 +561,11 @@ DoFObjectAccessor<1,DoFHandler<2> >::get_dof_indices (std::vector template <> inline unsigned int -DoFObjectAccessor<1,DoFHandler<3> >::dof_index (const unsigned int i) const +DoFObjectAccessor<1,DoFHandler<3> >::dof_index (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")); @@ -570,8 +586,11 @@ template <> inline unsigned int DoFObjectAccessor<1,DoFHandler<3> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i) const + 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")); @@ -633,8 +652,11 @@ DoFObjectAccessor<1,DoFHandler<3> >::get_dof_indices (std::vector template <> inline unsigned int -DoFObjectAccessor<2,DoFHandler<2> >::dof_index (const unsigned int i) const +DoFObjectAccessor<2,DoFHandler<2> >::dof_index (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, DoFAccessor >::ExcInvalidObject()); // make sure a FE has been selected @@ -656,8 +678,11 @@ template <> inline unsigned int DoFObjectAccessor<2,DoFHandler<2> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i) const + 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, DoFAccessor >::ExcInvalidObject()); Assert (&this->dof_handler->get_fe() != 0, @@ -725,8 +750,11 @@ DoFObjectAccessor<2,DoFHandler<2> >::get_dof_indices (std::vector template <> inline unsigned int -DoFObjectAccessor<2,DoFHandler<3> >::dof_index (const unsigned int i) const +DoFObjectAccessor<2,DoFHandler<3> >::dof_index (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, DoFAccessor >::ExcInvalidObject()); // make sure a FE has been selected @@ -748,8 +776,11 @@ template <> inline unsigned int DoFObjectAccessor<2,DoFHandler<3> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i) const + 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, DoFAccessor >::ExcInvalidObject()); Assert (&this->dof_handler->get_fe() != 0, @@ -822,8 +853,11 @@ DoFObjectAccessor<2,DoFHandler<3> >::get_dof_indices (std::vector template <> inline unsigned int -DoFObjectAccessor<3,DoFHandler<3> >::dof_index (const unsigned int i) const +DoFObjectAccessor<3,DoFHandler<3> >::dof_index (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, DoFAccessor >::ExcInvalidObject()); // make sure a FE has been selected @@ -845,8 +879,11 @@ template <> inline unsigned int DoFObjectAccessor<3,DoFHandler<3> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i) const + 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, DoFAccessor >::ExcInvalidObject()); Assert (&this->dof_handler->get_fe() != 0, @@ -923,8 +960,11 @@ template <> inline unsigned int DoFObjectAccessor<1,hp::DoFHandler<1> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i) const + const unsigned int i, + const unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<1>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), ExcMessage ("hp::DoFHandler not initialized")); @@ -946,8 +986,11 @@ template <> inline unsigned int DoFObjectAccessor<1,hp::DoFHandler<2> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i) const + const unsigned int i, + const unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<2>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), ExcMessage ("hp::DoFHandler not initialized")); @@ -968,8 +1011,11 @@ template <> inline unsigned int DoFObjectAccessor<1,hp::DoFHandler<3> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i) const + const unsigned int i, + const unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<3>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), ExcMessage ("hp::DoFHandler not initialized")); @@ -990,8 +1036,11 @@ template <> inline unsigned int DoFObjectAccessor<2,hp::DoFHandler<2> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i) const + const unsigned int i, + const unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<2>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); Assert (this->dof_handler != 0, DoFAccessor >::ExcInvalidObject()); Assert (&this->dof_handler->get_fe() != 0, @@ -1014,8 +1063,11 @@ template <> inline unsigned int DoFObjectAccessor<2,hp::DoFHandler<3> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i) const + const unsigned int i, + const unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<3>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); Assert (this->dof_handler != 0, DoFAccessor >::ExcInvalidObject()); Assert (&this->dof_handler->get_fe() != 0, @@ -1038,8 +1090,11 @@ template <> inline unsigned int DoFObjectAccessor<3,hp::DoFHandler<3> >::vertex_dof_index (const unsigned int vertex, - const unsigned int i) const + const unsigned int i, + const unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<3>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); Assert (this->dof_handler != 0, DoFAccessor >::ExcInvalidObject()); Assert (&this->dof_handler->get_fe() != 0, @@ -1062,8 +1117,12 @@ DoFObjectAccessor<3,hp::DoFHandler<3> >::vertex_dof_index (const unsigned int ve template <> inline unsigned int -DoFObjectAccessor<1,hp::DoFHandler<1> >::dof_index (const unsigned int i) const +DoFObjectAccessor<1,hp::DoFHandler<1> >::dof_index (const unsigned int i, + const unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<1>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); + // since the exception classes are // from a template dependent base // class, we have to fully qualify @@ -1143,8 +1202,11 @@ DoFObjectAccessor<1,hp::DoFHandler<1> >::get_dof_indices (std::vector inline unsigned int -DoFObjectAccessor<1,hp::DoFHandler<2> >::dof_index (const unsigned int i) const +DoFObjectAccessor<1,hp::DoFHandler<2> >::dof_index (const unsigned int i, + const unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<2>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); // since the exception classes are // from a template dependent base // class, we have to fully qualify @@ -1220,8 +1282,11 @@ DoFObjectAccessor<1,hp::DoFHandler<2> >::get_dof_indices (std::vector inline unsigned int -DoFObjectAccessor<1,hp::DoFHandler<3> >::dof_index (const unsigned int i) const +DoFObjectAccessor<1,hp::DoFHandler<3> >::dof_index (const unsigned int i, + const unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<3>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); // since the exception classes are // from a template dependent base // class, we have to fully qualify @@ -1298,8 +1363,11 @@ template <> inline void DoFObjectAccessor<1,hp::DoFHandler<1> >::set_dof_index (const unsigned int i, - const unsigned int index) const + const unsigned int index, + const unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<1>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); typedef DoFAccessor > BaseClass; Assert (this->dof_handler != 0, @@ -1334,8 +1402,11 @@ template <> inline void DoFObjectAccessor<1, hp::DoFHandler<2> >::set_dof_index (const unsigned int i, - const unsigned int index) const + const unsigned int index, + const unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<2>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); typedef DoFAccessor > BaseClass; Assert (this->dof_handler != 0, @@ -1370,8 +1441,11 @@ template <> inline void DoFObjectAccessor<1, hp::DoFHandler<3> >::set_dof_index (const unsigned int i, - const unsigned int index) const + const unsigned int index, + const unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<3>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); typedef DoFAccessor > BaseClass; Assert (this->dof_handler != 0, @@ -1403,8 +1477,11 @@ DoFObjectAccessor<1, hp::DoFHandler<3> >::set_dof_index (const unsigned int i, template <> inline -unsigned int DoFObjectAccessor<2,hp::DoFHandler<2> >::dof_index (const unsigned int i) const +unsigned int DoFObjectAccessor<2,hp::DoFHandler<2> >::dof_index (const unsigned int i, + const unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<2>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); typedef DoFAccessor > BaseClass; Assert (this->dof_handler != 0, @@ -1437,8 +1514,11 @@ unsigned int DoFObjectAccessor<2,hp::DoFHandler<2> >::dof_index (const unsigned template <> inline -unsigned int DoFObjectAccessor<2,hp::DoFHandler<3> >::dof_index (const unsigned int i) const +unsigned int DoFObjectAccessor<2,hp::DoFHandler<3> >::dof_index (const unsigned int i, + const unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<3>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); typedef DoFAccessor > BaseClass; Assert (this->dof_handler != 0, @@ -1469,8 +1549,11 @@ template <> inline void DoFObjectAccessor<2, hp::DoFHandler<2> >::set_dof_index (const unsigned int i, - const unsigned int index) const + const unsigned int index, + const unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<2>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); typedef DoFAccessor > BaseClass; Assert (this->dof_handler != 0, @@ -1505,8 +1588,11 @@ 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 unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<3>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); typedef DoFAccessor > BaseClass; Assert (this->dof_handler != 0, @@ -1632,8 +1718,11 @@ DoFObjectAccessor<2,hp::DoFHandler<3> >::get_dof_indices (std::vector inline unsigned int -DoFObjectAccessor<3,hp::DoFHandler<3> >::dof_index (const unsigned int i) const +DoFObjectAccessor<3,hp::DoFHandler<3> >::dof_index (const unsigned int i, + const unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<3>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); typedef DoFAccessor > BaseClass; Assert (this->dof_handler != 0, @@ -1668,8 +1757,11 @@ 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 unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<3>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); typedef DoFAccessor > BaseClass; Assert (this->dof_handler != 0, diff --git a/deal.II/deal.II/source/dofs/dof_accessor.cc b/deal.II/deal.II/source/dofs/dof_accessor.cc index 49ea3e7277..d31c0147c3 100644 --- a/deal.II/deal.II/source/dofs/dof_accessor.cc +++ b/deal.II/deal.II/source/dofs/dof_accessor.cc @@ -36,8 +36,11 @@ template void DoFObjectAccessor<1, DH>::set_dof_index (const unsigned int i, - const unsigned int index) const + 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")); typedef DoFAccessor BaseClass; Assert (this->dof_handler != 0, @@ -61,9 +64,12 @@ 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 + 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")); // since the exception classes are // from a template dependent base // class, we have to fully qualify @@ -166,8 +172,11 @@ DoFObjectAccessor<1,DH>::set_dof_values (const Vector &local_values, template void DoFObjectAccessor<2, DH>::set_dof_index (const unsigned int i, - const unsigned int index) const + 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")); typedef DoFAccessor BaseClass; Assert (this->dof_handler != 0, @@ -189,8 +198,11 @@ template void DoFObjectAccessor<2, DH>::set_vertex_dof_index (const unsigned int vertex, const unsigned int i, - const unsigned int index) const + 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")); typedef DoFAccessor BaseClass; Assert (this->dof_handler != 0, @@ -293,8 +305,11 @@ DoFObjectAccessor<2,DH>::set_dof_values (const Vector &local_values, template void DoFObjectAccessor<3, DH>::set_dof_index (const unsigned int i, - const unsigned int index) const + 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")); typedef DoFAccessor BaseClass; Assert (this->dof_handler != 0, @@ -315,8 +330,11 @@ 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 + 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")); typedef DoFAccessor BaseClass; Assert (this->dof_handler != 0, @@ -430,24 +448,33 @@ DoFObjectAccessor<3,DH>::set_dof_values (const Vector &local_values, template <> void DoFObjectAccessor<1, hp::DoFHandler<1> >::set_vertex_dof_index (const unsigned int /*vertex*/, const unsigned int /*i*/, - const unsigned int /*index*/) const + const unsigned int /*index*/, + const unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<1>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); Assert (false, ExcInternalError()); } template <> void DoFObjectAccessor<1, hp::DoFHandler<2> >::set_vertex_dof_index (const unsigned int /*vertex*/, const unsigned int /*i*/, - const unsigned int /*index*/) const + const unsigned int /*index*/, + const unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<2>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); Assert (false, ExcInternalError()); } template <> void DoFObjectAccessor<1, hp::DoFHandler<3> >::set_vertex_dof_index (const unsigned int /*vertex*/, const unsigned int /*i*/, - const unsigned int /*index*/) const + const unsigned int /*index*/, + const unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<3>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); Assert (false, ExcInternalError()); } @@ -516,16 +543,22 @@ DoFObjectAccessor<1,hp::DoFHandler<3> >::set_dof_values (const Vector &/ template <> void DoFObjectAccessor<2, hp::DoFHandler<2> >::set_vertex_dof_index (const unsigned int /*vertex*/, const unsigned int /*i*/, - const unsigned int /*index*/) const + const unsigned int /*index*/, + const unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<2>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); Assert (false, ExcInternalError()); } template <> void DoFObjectAccessor<2, hp::DoFHandler<3> >::set_vertex_dof_index (const unsigned int /*vertex*/, const unsigned int /*i*/, - const unsigned int /*index*/) const + const unsigned int /*index*/, + const unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<3>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); Assert (false, ExcInternalError()); } @@ -576,8 +609,11 @@ DoFObjectAccessor<2,hp::DoFHandler<3> >::set_dof_values (const Vector &/ template <> void DoFObjectAccessor<3, hp::DoFHandler<3> >::set_vertex_dof_index (const unsigned int /*vertex*/, const unsigned int /*i*/, - const unsigned int /*index*/) const + const unsigned int /*index*/, + const unsigned int fe_index) const { + Assert (fe_index != hp::DoFHandler<3>::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); Assert (false, ExcInternalError()); }