From 8df77aff57afc622820194f106cf5af8b07bf5cf Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 1 May 2006 17:47:18 +0000 Subject: [PATCH] Shuffle a few things around a bit more. Pretty much finish what needed to be done for hp. git-svn-id: https://svn.dealii.org/trunk@12941 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/dofs/dof_accessor.h | 529 +++++------ .../include/dofs/dof_accessor.templates.h | 205 ++-- deal.II/deal.II/source/dofs/dof_accessor.cc | 889 ++---------------- deal.II/doc/news/changes.html | 24 +- 4 files changed, 485 insertions(+), 1162 deletions(-) diff --git a/deal.II/deal.II/include/dofs/dof_accessor.h b/deal.II/deal.II/include/dofs/dof_accessor.h index 88bb9bd59b..9ab0ab2d12 100644 --- a/deal.II/deal.II/include/dofs/dof_accessor.h +++ b/deal.II/deal.II/include/dofs/dof_accessor.h @@ -452,7 +452,7 @@ class DoFObjectAccessor : public DoFAccessor, /** * Return the indices of the dofs of this - * quad in the standard ordering: dofs + * object in the standard ordering: dofs * on vertex 0, dofs on vertex 1, etc, * dofs on line 0, dofs on line 1, etc, * dofs on quad 0, etc. @@ -476,76 +476,54 @@ class DoFObjectAccessor : public DoFAccessor, * inactive edges do not have * degrees of freedom associated * with them at all. - */ - void get_dof_indices (std::vector &dof_indices) const; - - /** - * Return the values of the given vector - * restricted to the dofs of this - * cell in the standard ordering: dofs - * on vertex 0, dofs on vertex 1, etc, - * dofs on line 0, dofs on line 1, etc, - * dofs on quad 0, etc. - * - * The vector has to have the - * right size before being passed - * to this function. This - * function is only callable for - * active cells. - * - * The input vector may be either a - * Vector, - * Vector, or a - * BlockVector, or a - * PETSc vector if deal.II is compiled to - * support PETSc. It is in the - * responsibility of the caller to assure - * that the types of the numbers stored - * in input and output vectors are - * compatible and with similar accuracy. - */ - template - void get_dof_values (const InputVector &values, - Vector &local_values) const; - - /** - * This function is the counterpart to - * get_dof_values(): it takes a vector - * of values for the degrees of freedom - * of the cell pointed to by this iterator - * and writes these values into the global - * data vector @p values. This function - * is only callable for active cells. * - * Note that for continuous finite - * elements, calling this function affects - * the dof values on neighboring cells as - * well. It may also violate continuity - * requirements for hanging nodes, if - * neighboring cells are less refined than - * the present one. These requirements - * are not taken care of and must be - * enforced by the user afterwards. + * 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. * - * The vector has to have the - * right size before being passed - * to this function. + * 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(). * - * The output vector may be either a - * Vector, - * Vector, or a - * BlockVector, or a - * PETSc vector if deal.II is compiled to - * support PETSc. It is in the - * responsibility of the caller to assure - * that the types of the numbers stored - * in input and output vectors are - * compatible and with similar accuracy. - */ - template - void set_dof_values (const Vector &local_values, - OutputVector &values) const; - + * For cells, there is only a + * single possible finite element + * index (namely the one for that + * cell, returned by + * cell-@>active_fe_index. Consequently, + * the derived DoFCellAccessor + * class has an overloaded + * version of this function that + * calls the present function + * with + * cell-@>active_fe_index + * as last argument. + */ + void get_dof_indices (std::vector &dof_indices, + const unsigned int fe_index = DH::default_fe_index) const; + /** * Pointer to the ith line * bounding this Object. @@ -857,12 +835,14 @@ class DoFObjectAccessor<1, DH> : /** * Return the indices of the dofs of this - * line in the standard ordering: dofs - * on vertex 0, dofs on vertex 1, - * dofs on line. + * object in the standard ordering: dofs + * on vertex 0, dofs on vertex 1, etc, + * dofs on line 0, dofs on line 1, etc, + * dofs on quad 0, etc. * - * It is assumed that the vector already - * has the right size beforehand. + * The vector has to have the + * right size before being passed + * to this function. * * This function is most often * used on active objects (edges, @@ -879,73 +859,53 @@ class DoFObjectAccessor<1, DH> : * inactive edges do not have * degrees of freedom associated * with them at all. - */ - void get_dof_indices (std::vector &dof_indices) const; - - /** - * Return the values of the given vector - * restricted to the dofs of this - * cell in the standard ordering: dofs - * on vertex 0, dofs on vertex 1, etc, - * dofs on line 0, dofs on line 1, etc, - * dofs on quad 0, etc. - * - * It is assumed that the vector already - * has the right size beforehand. This - * function is only callable for active - * cells. - * - * The input vector may be either a - * Vector, - * Vector, or a - * BlockVector, or a - * PETSc vector if deal.II is compiled to - * support PETSc. It is in the - * responsibility of the caller to assure - * that the types of the numbers stored - * in input and output vectors are - * compatible and with similar accuracy. - */ - template - void get_dof_values (const InputVector &values, - Vector &local_values) const; - - /** - * This function is the counterpart to - * get_dof_values(): it takes a vector - * of values for the degrees of freedom - * of the cell pointed to by this iterator - * and writes these values into the global - * data vector @p values. This function - * is only callable for active cells. * - * Note that for continuous finite - * elements, calling this function affects - * the dof values on neighboring cells as - * well. It may also violate continuity - * requirements for hanging nodes, if - * neighboring cells are less refined than - * the present one. These requirements - * are not taken care of and must be - * enforced by the user afterwards. + * 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. * - * It is assumed that both vectors already - * have the right size beforehand. + * 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(). * - * The output vector may be either a - * Vector, - * Vector, or a - * BlockVector, or a - * PETSc vector if deal.II is compiled to - * support PETSc. It is in the - * responsibility of the caller to assure - * that the types of the numbers stored - * in input and output vectors are - * compatible and with similar accuracy. + * For cells, there is only a + * single possible finite element + * index (namely the one for that + * cell, returned by + * cell-@>active_fe_index. Consequently, + * the derived DoFCellAccessor + * class has an overloaded + * version of this function that + * calls the present function + * with + * cell-@>active_fe_index + * as last argument. */ - template - void set_dof_values (const Vector &local_values, - OutputVector &values) const; + 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 @@ -1188,13 +1148,14 @@ class DoFObjectAccessor<2, DH> : /** * Return the indices of the dofs of this - * quad in the standard ordering: dofs + * object in the standard ordering: dofs * on vertex 0, dofs on vertex 1, etc, * dofs on line 0, dofs on line 1, etc, * dofs on quad 0, etc. * - * It is assumed that the vector already - * has the right size beforehand. + * The vector has to have the + * right size before being passed + * to this function. * * This function is most often * used on active objects (edges, @@ -1211,73 +1172,53 @@ class DoFObjectAccessor<2, DH> : * inactive edges do not have * degrees of freedom associated * with them at all. - */ - void get_dof_indices (std::vector &dof_indices) const; - - /** - * Return the values of the given vector - * restricted to the dofs of this - * cell in the standard ordering: dofs - * on vertex 0, dofs on vertex 1, etc, - * dofs on line 0, dofs on line 1, etc, - * dofs on quad 0, etc. - * - * It is assumed that the vector already - * has the right size beforehand. This - * function is only callable for active - * cells. - * - * The input vector may be either a - * Vector, - * Vector, or a - * BlockVector, or a - * PETSc vector if deal.II is compiled to - * support PETSc. It is in the - * responsibility of the caller to assure - * that the types of the numbers stored - * in input and output vectors are - * compatible and with similar accuracy. - */ - template - void get_dof_values (const InputVector &values, - Vector &local_values) const; - - /** - * This function is the counterpart to - * get_dof_values(): it takes a vector - * of values for the degrees of freedom - * of the cell pointed to by this iterator - * and writes these values into the global - * data vector @p values. This function - * is only callable for active cells. * - * Note that for continuous finite - * elements, calling this function affects - * the dof values on neighboring cells as - * well. It may also violate continuity - * requirements for hanging nodes, if - * neighboring cells are less refined than - * the present one. These requirements - * are not taken care of and must be - * enforced by the user afterwards. + * 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. * - * It is assumed that both vectors already - * have the right size beforehand. + * 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(). * - * The output vector may be either a - * Vector, - * Vector, or a - * BlockVector, or a - * PETSc vector if deal.II is compiled to - * support PETSc. It is in the - * responsibility of the caller to assure - * that the types of the numbers stored - * in input and output vectors are - * compatible and with similar accuracy. - */ - template - void set_dof_values (const Vector &local_values, - OutputVector &values) const; + * For cells, there is only a + * single possible finite element + * index (namely the one for that + * cell, returned by + * cell-@>active_fe_index. Consequently, + * the derived DoFCellAccessor + * class has an overloaded + * version of this function that + * calls the present function + * with + * cell-@>active_fe_index + * as last argument. + */ + void get_dof_indices (std::vector &dof_indices, + const unsigned int fe_index = DH::default_fe_index) const; /** * Return a pointer to the @p ith line @@ -1529,13 +1470,14 @@ class DoFObjectAccessor<3, DH> : /** * Return the indices of the dofs of this - * hex in the standard ordering: dofs + * object in the standard ordering: dofs * on vertex 0, dofs on vertex 1, etc, * dofs on line 0, dofs on line 1, etc, * dofs on quad 0, etc. * - * It is assumed that the vector already - * has the right size beforehand. + * The vector has to have the + * right size before being passed + * to this function. * * This function is most often * used on active objects (edges, @@ -1552,73 +1494,53 @@ class DoFObjectAccessor<3, DH> : * inactive edges do not have * degrees of freedom associated * with them at all. - */ - void get_dof_indices (std::vector &dof_indices) const; - - /** - * Return the values of the given vector - * restricted to the dofs of this - * cell in the standard ordering: dofs - * on vertex 0, dofs on vertex 1, etc, - * dofs on line 0, dofs on line 1, etc, - * dofs on quad 0, etc. - * - * It is assumed that the vector already - * has the right size beforehand. This - * function is only callable for active - * cells. - * - * The input vector may be either a - * Vector, - * Vector, or a - * BlockVector, or a - * PETSc vector if deal.II is compiled to - * support PETSc. It is in the - * responsibility of the caller to assure - * that the types of the numbers stored - * in input and output vectors are - * compatible and with similar accuracy. - */ - template - void get_dof_values (const InputVector &values, - Vector &local_values) const; - - /** - * This function is the counterpart to - * get_dof_values(): it takes a vector - * of values for the degrees of freedom - * of the cell pointed to by this iterator - * and writes these values into the global - * data vector @p values. This function - * is only callable for active cells. * - * Note that for continuous finite - * elements, calling this function affects - * the dof values on neighboring cells as - * well. It may also violate continuity - * requirements for hanging nodes, if - * neighboring cells are less refined than - * the present one. These requirements - * are not taken care of and must be - * enforced by the user afterwards. + * 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. * - * It is assumed that both vectors already - * have the right size beforehand. + * 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(). * - * The output vector may be either a - * Vector, - * Vector, or a - * BlockVector, or a - * PETSc vector if deal.II is compiled to - * support PETSc. It is in the - * responsibility of the caller to assure - * that the types of the numbers stored - * in input and output vectors are - * compatible and with similar accuracy. - */ - template - void set_dof_values (const Vector &local_values, - OutputVector &values) const; + * For cells, there is only a + * single possible finite element + * index (namely the one for that + * cell, returned by + * cell-@>active_fe_index. Consequently, + * the derived DoFCellAccessor + * class has an overloaded + * version of this function that + * calls the present function + * with + * cell-@>active_fe_index + * as last argument. + */ + void get_dof_indices (std::vector &dof_indices, + const unsigned int fe_index = DH::default_fe_index) const; /** * Return a pointer to the @p ith line @@ -1766,6 +1688,73 @@ class DoFCellAccessor : public DoFObjectAccessor neighbor_child_on_subface (const unsigned int face_no, const unsigned int subface_no) const; + /** + * Return the values of the given vector + * restricted to the dofs of this + * cell in the standard ordering: dofs + * on vertex 0, dofs on vertex 1, etc, + * dofs on line 0, dofs on line 1, etc, + * dofs on quad 0, etc. + * + * The vector has to have the + * right size before being passed + * to this function. This + * function is only callable for + * active cells. + * + * The input vector may be either a + * Vector, + * Vector, or a + * BlockVector, or a + * PETSc vector if deal.II is compiled to + * support PETSc. It is in the + * responsibility of the caller to assure + * that the types of the numbers stored + * in input and output vectors are + * compatible and with similar accuracy. + */ + template + void get_dof_values (const InputVector &values, + Vector &local_values) const; + + /** + * This function is the counterpart to + * get_dof_values(): it takes a vector + * of values for the degrees of freedom + * of the cell pointed to by this iterator + * and writes these values into the global + * data vector @p values. This function + * is only callable for active cells. + * + * Note that for continuous finite + * elements, calling this function affects + * the dof values on neighboring cells as + * well. It may also violate continuity + * requirements for hanging nodes, if + * neighboring cells are less refined than + * the present one. These requirements + * are not taken care of and must be + * enforced by the user afterwards. + * + * The vector has to have the + * right size before being passed + * to this function. + * + * The output vector may be either a + * Vector, + * Vector, or a + * BlockVector, or a + * PETSc vector if deal.II is compiled to + * support PETSc. It is in the + * responsibility of the caller to assure + * that the types of the numbers stored + * in input and output vectors are + * compatible and with similar accuracy. + */ + template + void set_dof_values (const Vector &local_values, + OutputVector &values) const; + /** * Return the interpolation of * the given finite element 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 c31e55eb65..b8810ca8cd 100644 --- a/deal.II/deal.II/include/dofs/dof_accessor.templates.h +++ b/deal.II/deal.II/include/dofs/dof_accessor.templates.h @@ -218,7 +218,7 @@ DoFObjectAccessor<2,DH>::line (const unsigned int i) const this->present_level, this->line_index (i), this->dof_handler - ); + ); } @@ -309,7 +309,7 @@ DoFObjectAccessor<3,DH>::line (const unsigned int i) const this->present_level, l->index(), this->dof_handler - ); + ); } @@ -326,7 +326,7 @@ DoFObjectAccessor<3,DH>::quad (const unsigned int i) const this->present_level, this->quad_index (i), this->dof_handler - ); + ); } @@ -435,8 +435,11 @@ DoFObjectAccessor<1,DoFHandler<1> >::vertex_dof_index (const unsigned int vertex template <> inline void -DoFObjectAccessor<1,DoFHandler<1> >::get_dof_indices (std::vector &dof_indices) const +DoFObjectAccessor<1,DoFHandler<1> >::get_dof_indices (std::vector &dof_indices, + 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")); @@ -524,8 +527,11 @@ DoFObjectAccessor<1,DoFHandler<2> >::vertex_dof_index (const unsigned int vertex template <> inline void -DoFObjectAccessor<1,DoFHandler<2> >::get_dof_indices (std::vector &dof_indices) const +DoFObjectAccessor<1,DoFHandler<2> >::get_dof_indices (std::vector &dof_indices, + 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")); @@ -613,8 +619,11 @@ DoFObjectAccessor<1,DoFHandler<3> >::vertex_dof_index (const unsigned int vertex template <> inline void -DoFObjectAccessor<1,DoFHandler<3> >::get_dof_indices (std::vector &dof_indices) const +DoFObjectAccessor<1,DoFHandler<3> >::get_dof_indices (std::vector &dof_indices, + 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")); @@ -706,8 +715,11 @@ DoFObjectAccessor<2,DoFHandler<2> >::vertex_dof_index (const unsigned int vertex template <> inline void -DoFObjectAccessor<2,DoFHandler<2> >::get_dof_indices (std::vector &dof_indices) const +DoFObjectAccessor<2,DoFHandler<2> >::get_dof_indices (std::vector &dof_indices, + 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, @@ -804,8 +816,11 @@ DoFObjectAccessor<2,DoFHandler<3> >::vertex_dof_index (const unsigned int vertex template <> inline void -DoFObjectAccessor<2,DoFHandler<3> >::get_dof_indices (std::vector &dof_indices) const +DoFObjectAccessor<2,DoFHandler<3> >::get_dof_indices (std::vector &dof_indices, + 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, @@ -907,8 +922,11 @@ DoFObjectAccessor<3,DoFHandler<3> >::vertex_dof_index (const unsigned int vertex template <> inline void -DoFObjectAccessor<3,DoFHandler<3> >::get_dof_indices (std::vector &dof_indices) const +DoFObjectAccessor<3,DoFHandler<3> >::get_dof_indices (std::vector &dof_indices, + 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, @@ -1071,15 +1089,16 @@ DoFObjectAccessor<1,hp::DoFHandler<1> >::dof_index (const unsigned int i, template <> inline void -DoFObjectAccessor<1,hp::DoFHandler<1> >::get_dof_indices (std::vector &dof_indices) const +DoFObjectAccessor<1,hp::DoFHandler<1> >::get_dof_indices (std::vector &dof_indices, + const unsigned int fe_index) const { Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), ExcMessage ("DoFHandler not initialized")); Assert (this->dof_handler != 0, DoFAccessor >::ExcInvalidObject()); Assert (&this->dof_handler->get_fe() != 0, DoFAccessor >::ExcInvalidObject()); - Assert (dof_indices.size() == (2*this->dof_handler->get_fe()[0].dofs_per_vertex + - this->dof_handler->get_fe()[0].dofs_per_line), + Assert (dof_indices.size() == (2*this->dof_handler->get_fe()[fe_index].dofs_per_vertex + + this->dof_handler->get_fe()[fe_index].dofs_per_line), DoFAccessor >::ExcVectorDoesNotMatch()); // this function really only makes @@ -1091,18 +1110,18 @@ DoFObjectAccessor<1,hp::DoFHandler<1> >::get_dof_indices (std::vectorhas_children() || - (this->dof_handler->get_fe()[0].dofs_per_cell == - 2*this->dof_handler->get_fe()[0].dofs_per_vertex), + (this->dof_handler->get_fe()[fe_index].dofs_per_cell == + 2*this->dof_handler->get_fe()[fe_index].dofs_per_vertex), DoFAccessor >::ExcNotActive()); - const unsigned int dofs_per_vertex = this->dof_handler->get_fe()[0].dofs_per_vertex, - dofs_per_line = this->dof_handler->get_fe()[0].dofs_per_line; + const unsigned int dofs_per_vertex = this->dof_handler->get_fe()[fe_index].dofs_per_vertex, + dofs_per_line = this->dof_handler->get_fe()[fe_index].dofs_per_line; std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<2; ++vertex) for (unsigned int d=0; d >::dof_index (const unsigned int i, template <> inline void -DoFObjectAccessor<1,hp::DoFHandler<2> >::get_dof_indices (std::vector &dof_indices) const +DoFObjectAccessor<1,hp::DoFHandler<2> >::get_dof_indices (std::vector &dof_indices, + const unsigned int fe_index) const { Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), ExcMessage ("DoFHandler not initialized")); Assert (this->dof_handler != 0, DoFAccessor >::ExcInvalidObject()); Assert (&this->dof_handler->get_fe() != 0, DoFAccessor >::ExcInvalidObject()); - Assert (dof_indices.size() == (2*this->dof_handler->get_fe()[0].dofs_per_vertex + - this->dof_handler->get_fe()[0].dofs_per_line), + Assert (dof_indices.size() == (2*this->dof_handler->get_fe()[fe_index].dofs_per_vertex + + this->dof_handler->get_fe()[fe_index].dofs_per_line), DoFAccessor >::ExcVectorDoesNotMatch()); // this function really only makes @@ -1145,18 +1165,18 @@ DoFObjectAccessor<1,hp::DoFHandler<2> >::get_dof_indices (std::vectorhas_children() || - (this->dof_handler->get_fe()[0].dofs_per_cell == - 2*this->dof_handler->get_fe()[0].dofs_per_vertex), + (this->dof_handler->get_fe()[fe_index].dofs_per_cell == + 2*this->dof_handler->get_fe()[fe_index].dofs_per_vertex), DoFAccessor >::ExcNotActive()); - const unsigned int dofs_per_vertex = this->dof_handler->get_fe()[0].dofs_per_vertex, - dofs_per_line = this->dof_handler->get_fe()[0].dofs_per_line; + const unsigned int dofs_per_vertex = this->dof_handler->get_fe()[fe_index].dofs_per_vertex, + dofs_per_line = this->dof_handler->get_fe()[fe_index].dofs_per_line; std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<2; ++vertex) for (unsigned int d=0; d >::dof_index (const unsigned int i, template <> inline void -DoFObjectAccessor<1,hp::DoFHandler<3> >::get_dof_indices (std::vector &dof_indices) const +DoFObjectAccessor<1,hp::DoFHandler<3> >::get_dof_indices (std::vector &dof_indices, + const unsigned int fe_index) const { Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), ExcMessage ("DoFHandler not initialized")); Assert (this->dof_handler != 0, DoFAccessor >::ExcInvalidObject()); Assert (&this->dof_handler->get_fe() != 0, DoFAccessor >::ExcInvalidObject()); - Assert (dof_indices.size() == (2*this->dof_handler->get_fe()[0].dofs_per_vertex + - this->dof_handler->get_fe()[0].dofs_per_line), + Assert (dof_indices.size() == (2*this->dof_handler->get_fe()[fe_index].dofs_per_vertex + + this->dof_handler->get_fe()[fe_index].dofs_per_line), DoFAccessor >::ExcVectorDoesNotMatch()); // this function really only makes @@ -1199,18 +1220,18 @@ DoFObjectAccessor<1,hp::DoFHandler<3> >::get_dof_indices (std::vectorhas_children() || - (this->dof_handler->get_fe()[0].dofs_per_cell == - 2*this->dof_handler->get_fe()[0].dofs_per_vertex), + (this->dof_handler->get_fe()[fe_index].dofs_per_cell == + 2*this->dof_handler->get_fe()[fe_index].dofs_per_vertex), DoFAccessor >::ExcNotActive()); - const unsigned int dofs_per_vertex = this->dof_handler->get_fe()[0].dofs_per_vertex, - dofs_per_line = this->dof_handler->get_fe()[0].dofs_per_line; + const unsigned int dofs_per_vertex = this->dof_handler->get_fe()[fe_index].dofs_per_vertex, + dofs_per_line = this->dof_handler->get_fe()[fe_index].dofs_per_line; std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<2; ++vertex) for (unsigned int d=0; d >::set_dof_index (const unsigned int i, template <> inline void -DoFObjectAccessor<2,hp::DoFHandler<2> >::get_dof_indices (std::vector &dof_indices) const +DoFObjectAccessor<2,hp::DoFHandler<2> >::get_dof_indices (std::vector &dof_indices, + const unsigned int fe_index) const { Assert (this->dof_handler != 0, DoFAccessor >::ExcInvalidObject()); Assert (&this->dof_handler->get_fe() != 0, DoFAccessor >::ExcInvalidObject()); - Assert (dof_indices.size() == (4*this->dof_handler->get_fe()[0].dofs_per_vertex + - 4*this->dof_handler->get_fe()[0].dofs_per_line + - this->dof_handler->get_fe()[0].dofs_per_quad), + Assert (dof_indices.size() == (4*this->dof_handler->get_fe()[fe_index].dofs_per_vertex + + 4*this->dof_handler->get_fe()[fe_index].dofs_per_line + + this->dof_handler->get_fe()[fe_index].dofs_per_quad), DoFAccessor >::ExcVectorDoesNotMatch()); // this function really only makes @@ -1354,25 +1376,25 @@ DoFObjectAccessor<2,hp::DoFHandler<2> >::get_dof_indices (std::vectorhas_children() || - (this->dof_handler->get_fe()[0].dofs_per_cell == - 4*this->dof_handler->get_fe()[0].dofs_per_vertex), + (this->dof_handler->get_fe()[fe_index].dofs_per_cell == + 4*this->dof_handler->get_fe()[fe_index].dofs_per_vertex), DoFAccessor >::ExcNotActive()); Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), ExcMessage ("DoFHandler not initialized")); - const unsigned int dofs_per_vertex = this->dof_handler->get_fe()[0].dofs_per_vertex, - dofs_per_line = this->dof_handler->get_fe()[0].dofs_per_line, - dofs_per_quad = this->dof_handler->get_fe()[0].dofs_per_quad; + const unsigned int dofs_per_vertex = this->dof_handler->get_fe()[fe_index].dofs_per_vertex, + dofs_per_line = this->dof_handler->get_fe()[fe_index].dofs_per_line, + dofs_per_quad = this->dof_handler->get_fe()[fe_index].dofs_per_quad; std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<4; ++vertex) for (unsigned int d=0; dline(line)->dof_index(d); + *next++ = this->line(line)->dof_index(d,fe_index); for (unsigned int d=0; d >::get_dof_indices (std::vector inline void -DoFObjectAccessor<2,hp::DoFHandler<3> >::get_dof_indices (std::vector &dof_indices) const +DoFObjectAccessor<2,hp::DoFHandler<3> >::get_dof_indices (std::vector &dof_indices, + const unsigned int fe_index) const { Assert (this->dof_handler != 0, DoFAccessor >::ExcInvalidObject()); Assert (&this->dof_handler->get_fe() != 0, DoFAccessor >::ExcInvalidObject()); - Assert (dof_indices.size() == (4*this->dof_handler->get_fe()[0].dofs_per_vertex + - 4*this->dof_handler->get_fe()[0].dofs_per_line + - this->dof_handler->get_fe()[0].dofs_per_quad), + Assert (dof_indices.size() == (4*this->dof_handler->get_fe()[fe_index].dofs_per_vertex + + 4*this->dof_handler->get_fe()[fe_index].dofs_per_line + + this->dof_handler->get_fe()[fe_index].dofs_per_quad), DoFAccessor >::ExcVectorDoesNotMatch()); // this function really only makes @@ -1400,25 +1423,25 @@ DoFObjectAccessor<2,hp::DoFHandler<3> >::get_dof_indices (std::vectorhas_children() || - (this->dof_handler->get_fe()[0].dofs_per_cell == - 4*this->dof_handler->get_fe()[0].dofs_per_vertex), + (this->dof_handler->get_fe()[fe_index].dofs_per_cell == + 4*this->dof_handler->get_fe()[fe_index].dofs_per_vertex), DoFAccessor >::ExcNotActive()); Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), ExcMessage ("DoFHandler not initialized")); - const unsigned int dofs_per_vertex = this->dof_handler->get_fe()[0].dofs_per_vertex, - dofs_per_line = this->dof_handler->get_fe()[0].dofs_per_line, - dofs_per_quad = this->dof_handler->get_fe()[0].dofs_per_quad; + const unsigned int dofs_per_vertex = this->dof_handler->get_fe()[fe_index].dofs_per_vertex, + dofs_per_line = this->dof_handler->get_fe()[fe_index].dofs_per_line, + dofs_per_quad = this->dof_handler->get_fe()[fe_index].dofs_per_quad; std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<4; ++vertex) for (unsigned int d=0; dline(line)->dof_index(d); + *next++ = this->line(line)->dof_index(d,fe_index); for (unsigned int d=0; d >::set_dof_index (const unsigned int i, template <> inline void -DoFObjectAccessor<3,hp::DoFHandler<3> >::get_dof_indices (std::vector &dof_indices) const +DoFObjectAccessor<3,hp::DoFHandler<3> >::get_dof_indices (std::vector &dof_indices, + const unsigned int fe_index) const { Assert (this->dof_handler != 0, DoFAccessor >::ExcInvalidObject()); Assert (&this->dof_handler->get_fe() != 0, DoFAccessor >::ExcInvalidObject()); - Assert (dof_indices.size() == (8*this->dof_handler->get_fe()[0].dofs_per_vertex + - 12*this->dof_handler->get_fe()[0].dofs_per_line + - 6*this->dof_handler->get_fe()[0].dofs_per_quad + - this->dof_handler->get_fe()[0].dofs_per_hex), + Assert (dof_indices.size() == (8*this->dof_handler->get_fe()[fe_index].dofs_per_vertex + + 12*this->dof_handler->get_fe()[fe_index].dofs_per_line + + 6*this->dof_handler->get_fe()[fe_index].dofs_per_quad + + this->dof_handler->get_fe()[fe_index].dofs_per_hex), DoFAccessor >::ExcVectorDoesNotMatch()); Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), ExcMessage ("DoFHandler not initialized")); @@ -1485,28 +1509,28 @@ DoFObjectAccessor<3,hp::DoFHandler<3> >::get_dof_indices (std::vectorhas_children() || - (this->dof_handler->get_fe()[0].dofs_per_cell == - 8*this->dof_handler->get_fe()[0].dofs_per_vertex), + (this->dof_handler->get_fe()[fe_index].dofs_per_cell == + 8*this->dof_handler->get_fe()[fe_index].dofs_per_vertex), DoFAccessor >::ExcNotActive()); Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), ExcMessage ("DoFHandler not initialized")); - const unsigned int dofs_per_vertex = this->dof_handler->get_fe()[0].dofs_per_vertex, - dofs_per_line = this->dof_handler->get_fe()[0].dofs_per_line, - dofs_per_quad = this->dof_handler->get_fe()[0].dofs_per_quad, - dofs_per_hex = this->dof_handler->get_fe()[0].dofs_per_hex; + const unsigned int dofs_per_vertex = this->dof_handler->get_fe()[fe_index].dofs_per_vertex, + dofs_per_line = this->dof_handler->get_fe()[fe_index].dofs_per_line, + dofs_per_quad = this->dof_handler->get_fe()[fe_index].dofs_per_quad, + dofs_per_hex = this->dof_handler->get_fe()[fe_index].dofs_per_hex; std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<8; ++vertex) for (unsigned int d=0; dline(line)->dof_index(d); + *next++ = this->line(line)->dof_index(d,fe_index); for (unsigned int quad=0; quad<6; ++quad) for (unsigned int d=0; dquad(quad)->dof_index(d); + *next++ = this->quad(quad)->dof_index(d,fe_index); for (unsigned int d=0; d >:: get_dof_indices (std::vector &dof_indices) const { // no caching for hp::DoFHandler implemented - DoFObjectAccessor >::get_dof_indices (dof_indices); + DoFObjectAccessor >::get_dof_indices (dof_indices, + this->active_fe_index()); } @@ -1666,7 +1691,8 @@ DoFCellAccessor >:: get_dof_indices (std::vector &dof_indices) const { // no caching for hp::DoFHandler implemented - DoFObjectAccessor >::get_dof_indices (dof_indices); + DoFObjectAccessor >::get_dof_indices (dof_indices, + this->active_fe_index()); } @@ -1697,6 +1723,19 @@ get_dof_indices (std::vector &dof_indices) const +template <> +inline +void +DoFCellAccessor >:: +get_dof_indices (std::vector &dof_indices) const +{ + // no caching for hp::DoFHandler implemented + DoFObjectAccessor >::get_dof_indices (dof_indices, + this->active_fe_index()); +} + + + template inline const FiniteElement & @@ -1876,18 +1915,6 @@ DoFCellAccessor >::set_active_fe_index (const unsigned int i) -template <> -inline -void -DoFCellAccessor >:: -get_dof_indices (std::vector &dof_indices) const -{ - // no caching for hp::DoFHandler implemented - DoFObjectAccessor >::get_dof_indices (dof_indices); -} - - - template template inline diff --git a/deal.II/deal.II/source/dofs/dof_accessor.cc b/deal.II/deal.II/source/dofs/dof_accessor.cc index 324e121d3a..03760ceecc 100644 --- a/deal.II/deal.II/source/dofs/dof_accessor.cc +++ b/deal.II/deal.II/source/dofs/dof_accessor.cc @@ -97,76 +97,6 @@ void DoFObjectAccessor<1, DH>::set_vertex_dof_index (const unsigned int vertex, -template -template -void -DoFObjectAccessor<1,DH>::get_dof_values (const InputVector &values, - Vector &local_values) const -{ - typedef DoFAccessor BaseClass; - - Assert (dim==1, ExcInternalError()); - - Assert (this->dof_handler != 0, typename BaseClass::ExcInvalidObject()); - Assert (&this->dof_handler->get_fe() != 0, - typename BaseClass::ExcInvalidObject()); - Assert (local_values.size() == this->dof_handler->get_fe().dofs_per_cell, - typename BaseClass::ExcVectorDoesNotMatch()); - Assert (values.size() == this->dof_handler->n_dofs(), - typename BaseClass::ExcVectorDoesNotMatch()); - Assert (this->has_children() == false, - typename BaseClass::ExcNotActive()); - - const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex, - dofs_per_line = this->dof_handler->get_fe().dofs_per_line; - typename Vector::iterator next_local_value=local_values.begin(); - for (unsigned int vertex=0; vertex<2; ++vertex) - for (unsigned int d=0; d -template -void -DoFObjectAccessor<1,DH>::set_dof_values (const Vector &local_values, - OutputVector &values) const -{ - typedef DoFAccessor BaseClass; - - Assert (dim==1, ExcInternalError()); - - Assert (this->dof_handler != 0, typename BaseClass::ExcInvalidObject()); - Assert (&this->dof_handler->get_fe() != 0, - typename BaseClass::ExcInvalidObject()); - Assert (local_values.size() == this->dof_handler->get_fe().dofs_per_cell, - typename BaseClass::ExcVectorDoesNotMatch()); - Assert (values.size() == this->dof_handler->n_dofs(), - typename BaseClass::ExcVectorDoesNotMatch()); - Assert (this->has_children() == false, - typename BaseClass::ExcNotActive()); - - const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex, - dofs_per_line = this->dof_handler->get_fe().dofs_per_line; - typename Vector::const_iterator next_local_value=local_values.begin(); - for (unsigned int vertex=0; vertex<2; ++vertex) - for (unsigned int d=0; d -----------------------*/ @@ -221,85 +151,6 @@ DoFObjectAccessor<2, DH>::set_vertex_dof_index (const unsigned int vertex, -template -template -void -DoFObjectAccessor<2,DH>::get_dof_values (const InputVector &values, - Vector &local_values) const -{ - typedef DoFAccessor BaseClass; - - Assert (dim==2, ExcInternalError()); - - Assert (this->dof_handler != 0, - typename BaseClass::ExcInvalidObject()); - Assert (&this->dof_handler->get_fe() != 0, - typename BaseClass::ExcInvalidObject()); - Assert (local_values.size() == this->dof_handler->get_fe().dofs_per_cell, - typename BaseClass::ExcVectorDoesNotMatch()); - Assert (values.size() == this->dof_handler->n_dofs(), - typename BaseClass::ExcVectorDoesNotMatch()); - Assert (this->has_children() == false, - typename BaseClass::ExcNotActive()); - - const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex, - dofs_per_line = this->dof_handler->get_fe().dofs_per_line, - dofs_per_quad = this->dof_handler->get_fe().dofs_per_quad; - typename Vector::iterator next_local_value=local_values.begin(); - for (unsigned int vertex=0; vertex<4; ++vertex) - for (unsigned int d=0; dline(line)->dof_index(d)); - for (unsigned int d=0; d -template -void -DoFObjectAccessor<2,DH>::set_dof_values (const Vector &local_values, - OutputVector &values) const -{ - typedef DoFAccessor BaseClass; - - Assert (dim==2, ExcInternalError()); - - Assert (this->dof_handler != 0, - typename BaseClass::ExcInvalidObject()); - Assert (&this->dof_handler->get_fe() != 0, - typename BaseClass::ExcInvalidObject()); - Assert (local_values.size() == this->dof_handler->get_fe().dofs_per_cell, - typename BaseClass::ExcVectorDoesNotMatch()); - Assert (values.size() == this->dof_handler->n_dofs(), - typename BaseClass::ExcVectorDoesNotMatch()); - Assert (this->has_children() == false, - typename BaseClass::ExcNotActive()); - - const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex, - dofs_per_line = this->dof_handler->get_fe().dofs_per_line, - dofs_per_quad = this->dof_handler->get_fe().dofs_per_quad; - typename Vector::const_iterator next_local_value=local_values.begin(); - for (unsigned int vertex=0; vertex<4; ++vertex) - for (unsigned int d=0; dline(line)->dof_index(d)) = *next_local_value++; - for (unsigned int d=0; d -----------------------*/ @@ -354,93 +205,6 @@ void DoFObjectAccessor<3, DH>::set_vertex_dof_index (const unsigned int vertex, -template -template -void -DoFObjectAccessor<3,DH>::get_dof_values (const InputVector &values, - Vector &local_values) const -{ - typedef DoFAccessor BaseClass; - - Assert (dim==3, ExcInternalError()); - - Assert (this->dof_handler != 0, - typename BaseClass::ExcInvalidObject()); - Assert (&this->dof_handler->get_fe() != 0, - typename BaseClass::ExcInvalidObject()); - Assert (local_values.size() == this->dof_handler->get_fe().dofs_per_cell, - typename BaseClass::ExcVectorDoesNotMatch()); - Assert (values.size() == this->dof_handler->n_dofs(), - typename BaseClass::ExcVectorDoesNotMatch()); - Assert (this->has_children() == false, - typename BaseClass::ExcNotActive()); - - const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex, - dofs_per_line = this->dof_handler->get_fe().dofs_per_line, - dofs_per_quad = this->dof_handler->get_fe().dofs_per_quad, - dofs_per_hex = this->dof_handler->get_fe().dofs_per_hex; - typename Vector::iterator next_local_value = local_values.begin(); - for (unsigned int vertex=0; vertex::vertices_per_cell; ++vertex) - for (unsigned int d=0; d::lines_per_cell; ++line) - for (unsigned int d=0; dline(line)->dof_index(d)); - for (unsigned int quad=0; quad::quads_per_cell; ++quad) - for (unsigned int d=0; dquad(quad)->dof_index(d)); - for (unsigned int d=0; d -template -void -DoFObjectAccessor<3,DH>::set_dof_values (const Vector &local_values, - OutputVector &values) const -{ - typedef DoFAccessor BaseClass; - - Assert (dim==3, ExcInternalError()); - - Assert (this->dof_handler != 0, - typename BaseClass::ExcInvalidObject()); - Assert (&this->dof_handler->get_fe() != 0, - typename BaseClass::ExcInvalidObject()); - Assert (local_values.size() == this->dof_handler->get_fe().dofs_per_cell, - typename BaseClass::ExcVectorDoesNotMatch()); - Assert (values.size() == this->dof_handler->n_dofs(), - typename BaseClass::ExcVectorDoesNotMatch()); - Assert (this->has_children() == false, - typename BaseClass::ExcNotActive()); - - const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex, - dofs_per_line = this->dof_handler->get_fe().dofs_per_line, - dofs_per_quad = this->dof_handler->get_fe().dofs_per_quad, - dofs_per_hex = this->dof_handler->get_fe().dofs_per_hex; - typename Vector::const_iterator next_local_value=local_values.begin(); - for (unsigned int vertex=0; vertex::vertices_per_cell; ++vertex) - for (unsigned int d=0; d::lines_per_cell; ++line) - for (unsigned int d=0; dline(line)->dof_index(d)) = *next_local_value++; - for (unsigned int quad=0; quad::quads_per_cell; ++quad) - for (unsigned int d=0; dquad(quad)->dof_index(d)) = *next_local_value++; - for (unsigned int d=0; d >::set_vertex_dof_index (const unsig index); } -template <> -template -void -DoFObjectAccessor<1,hp::DoFHandler<1> >::get_dof_values (const InputVector &/*values*/, - Vector &/*local_values*/) const -{ - Assert (false, ExcNotImplemented()); -} - -template <> -template -void -DoFObjectAccessor<1,hp::DoFHandler<1> >::set_dof_values (const Vector &/*local_values*/, - OutputVector &/*values*/) const -{ - Assert (false, ExcNotImplemented()); -} #endif @@ -515,42 +262,6 @@ void DoFObjectAccessor<2, hp::DoFHandler<2> >::set_vertex_dof_index (const unsig index); } -template <> -template -void -DoFObjectAccessor<1,hp::DoFHandler<2> >::get_dof_values (const InputVector &/*values*/, - Vector &/*local_values*/) const -{ - Assert (false, ExcNotImplemented()); -} - -template <> -template -void -DoFObjectAccessor<2,hp::DoFHandler<2> >::get_dof_values (const InputVector &/*values*/, - Vector &/*local_values*/) const -{ - Assert (false, ExcNotImplemented()); -} - -template <> -template -void -DoFObjectAccessor<1,hp::DoFHandler<2> >::set_dof_values (const Vector &/*local_values*/, - OutputVector &/*values*/) const -{ - Assert (false, ExcNotImplemented()); -} - - -template <> -template -void -DoFObjectAccessor<2,hp::DoFHandler<2> >::set_dof_values (const Vector &/*local_values*/, - OutputVector &/*values*/) const -{ - Assert (false, ExcNotImplemented()); -} #endif @@ -601,63 +312,6 @@ void DoFObjectAccessor<3, hp::DoFHandler<3> >::set_vertex_dof_index (const unsig } -template <> -template -void -DoFObjectAccessor<1,hp::DoFHandler<3> >::get_dof_values (const InputVector &/*values*/, - Vector &/*local_values*/) const -{ - Assert (false, ExcNotImplemented()); -} - -template <> -template -void -DoFObjectAccessor<2,hp::DoFHandler<3> >::get_dof_values (const InputVector &/*values*/, - Vector &/*local_values*/) const -{ - Assert (false, ExcNotImplemented()); -} - - -template <> -template -void -DoFObjectAccessor<3,hp::DoFHandler<3> >::get_dof_values (const InputVector &/*values*/, - Vector &/*local_values*/) const -{ - Assert (false, ExcNotImplemented()); -} - - -template <> -template -void -DoFObjectAccessor<1,hp::DoFHandler<3> >::set_dof_values (const Vector &/*local_values*/, - OutputVector &/*values*/) const -{ - Assert (false, ExcNotImplemented()); -} - -template <> -template -void -DoFObjectAccessor<2,hp::DoFHandler<3> >::set_dof_values (const Vector &/*local_values*/, - OutputVector &/*values*/) const -{ - Assert (false, ExcNotImplemented()); -} - -template <> -template -void -DoFObjectAccessor<3,hp::DoFHandler<3> >::set_dof_values (const Vector &/*local_values*/, - OutputVector &/*values*/) const -{ - Assert (false, ExcNotImplemented()); -} - - #endif @@ -913,6 +567,45 @@ DoFCellAccessor::neighbor_child_on_subface (const unsigned int face, +template +template +void +DoFCellAccessor::get_dof_values (const InputVector &values, + Vector &local_values) const +{ +//TODO[WB]: this function can be made more efficient using the fact that we have cached the result of get_dof_indices; we should therefore be able to get away without having to allocate memory + + const unsigned int dofs_per_cell = this->get_fe().dofs_per_cell; + + std::vector local_dof_indices (dofs_per_cell); + this->get_dof_indices (local_dof_indices); + + for (unsigned int i=0; i +template +void +DoFCellAccessor::set_dof_values (const Vector &local_values, + OutputVector &values) const +{ +//TODO[WB]: this function can be made more efficient using the fact that we have cached the result of get_dof_indices; we should therefore be able to get away without having to allocate memory + + const unsigned int dofs_per_cell = this->get_fe().dofs_per_cell; + + std::vector local_dof_indices (dofs_per_cell); + this->get_dof_indices (local_dof_indices); + + for (unsigned int i=0; i template void @@ -1081,325 +774,110 @@ set_dof_values_by_interpolation (const Vector &local_values, template void -DoFObjectAccessor<1,DoFHandler >::get_dof_values,double> +DoFCellAccessor >::get_dof_values,double> (const Vector&, Vector&) const; template void -DoFObjectAccessor<1,DoFHandler >::set_dof_values,double> +DoFCellAccessor >::set_dof_values,double> (const Vector&, Vector&) const; template void -DoFObjectAccessor<1,DoFHandler >::get_dof_values,float> +DoFCellAccessor >::get_dof_values,float> (const Vector&, Vector&) const; template void -DoFObjectAccessor<1,DoFHandler >::set_dof_values,double> +DoFCellAccessor >::set_dof_values,double> (const Vector&, Vector&) const; template void -DoFObjectAccessor<1,DoFHandler >::get_dof_values,double> +DoFCellAccessor >::get_dof_values,double> (const Vector&, Vector&) const; template void -DoFObjectAccessor<1,DoFHandler >::set_dof_values,float> +DoFCellAccessor >::set_dof_values,float> (const Vector&, Vector&) const; template void -DoFObjectAccessor<1,DoFHandler >::get_dof_values,float> +DoFCellAccessor >::get_dof_values,float> (const Vector&, Vector&) const; template void -DoFObjectAccessor<1,DoFHandler >::set_dof_values,float> +DoFCellAccessor >::set_dof_values,float> (const Vector&, Vector&) const; // for block vector template void -DoFObjectAccessor<1,DoFHandler >::get_dof_values,double> +DoFCellAccessor >::get_dof_values,double> (const BlockVector &, Vector&) const; template void -DoFObjectAccessor<1,DoFHandler >::set_dof_values,double> +DoFCellAccessor >::set_dof_values,double> (const Vector&, BlockVector&) const; template void -DoFObjectAccessor<1,DoFHandler >::get_dof_values,float> +DoFCellAccessor >::get_dof_values,float> (const BlockVector &, Vector&) const; template void -DoFObjectAccessor<1,DoFHandler >::set_dof_values,double> +DoFCellAccessor >::set_dof_values,double> (const Vector&, BlockVector&) const; template void -DoFObjectAccessor<1,DoFHandler >::get_dof_values,double> +DoFCellAccessor >::get_dof_values,double> (const BlockVector &, Vector&) const; template void -DoFObjectAccessor<1,DoFHandler >::set_dof_values,float> +DoFCellAccessor >::set_dof_values,float> (const Vector&, BlockVector&) const; template void -DoFObjectAccessor<1,DoFHandler >::get_dof_values,float> +DoFCellAccessor >::get_dof_values,float> (const BlockVector&, Vector&) const; template void -DoFObjectAccessor<1,DoFHandler >::set_dof_values,float> +DoFCellAccessor >::set_dof_values,float> (const Vector&, BlockVector&) const; // for Petsc vectors #ifdef DEAL_II_USE_PETSC template void -DoFObjectAccessor<1,DoFHandler >::get_dof_values +DoFCellAccessor >::get_dof_values (const PETScWrappers::Vector &, Vector&) const; template void -DoFObjectAccessor<1,DoFHandler >::get_dof_values +DoFCellAccessor >::get_dof_values (const PETScWrappers::Vector &, Vector&) const; template void -DoFObjectAccessor<1,DoFHandler >::set_dof_values +DoFCellAccessor >::set_dof_values (const Vector &, PETScWrappers::Vector&) const; template void -DoFObjectAccessor<1,DoFHandler >::set_dof_values +DoFCellAccessor >::set_dof_values (const Vector&, PETScWrappers::Vector&) const; template void -DoFObjectAccessor<1,DoFHandler >::get_dof_values +DoFCellAccessor >::get_dof_values (const PETScWrappers::BlockVector &, Vector&) const; template void -DoFObjectAccessor<1,DoFHandler >::get_dof_values +DoFCellAccessor >::get_dof_values (const PETScWrappers::BlockVector &, Vector&) const; template void -DoFObjectAccessor<1,DoFHandler >::set_dof_values +DoFCellAccessor >::set_dof_values (const Vector &, PETScWrappers::BlockVector&) const; template void -DoFObjectAccessor<1,DoFHandler >::set_dof_values +DoFCellAccessor >::set_dof_values (const Vector&, PETScWrappers::BlockVector&) const; #endif - -#if deal_II_dimension >= 2 -template -void -DoFObjectAccessor<2,DoFHandler >::get_dof_values,double> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<2,DoFHandler >::set_dof_values,double> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<2,DoFHandler >::get_dof_values,float> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<2,DoFHandler >::set_dof_values,double> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<2,DoFHandler >::get_dof_values,double> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<2,DoFHandler >::set_dof_values,float> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<2,DoFHandler >::get_dof_values,float> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<2,DoFHandler >::set_dof_values,float> -(const Vector&, Vector&) const; - - -// for block vector -template -void -DoFObjectAccessor<2,DoFHandler >::get_dof_values,double> -(const BlockVector&, Vector&) const; -template -void -DoFObjectAccessor<2,DoFHandler >::set_dof_values,double> -(const Vector&, BlockVector&) const; -template -void -DoFObjectAccessor<2,DoFHandler >::get_dof_values,float> -(const BlockVector&, Vector&) const; -template -void -DoFObjectAccessor<2,DoFHandler >::set_dof_values,double> -(const Vector&, BlockVector&) const; -template -void -DoFObjectAccessor<2,DoFHandler >::get_dof_values,double> -(const BlockVector&, Vector&) const; -template -void -DoFObjectAccessor<2,DoFHandler >::set_dof_values,float> -(const Vector&, BlockVector&) const; -template -void -DoFObjectAccessor<2,DoFHandler >::get_dof_values,float> -(const BlockVector&, Vector&) const; -template -void -DoFObjectAccessor<2,DoFHandler >::set_dof_values,float> -(const Vector&, BlockVector&) const; - -// for Petsc vectors -#ifdef DEAL_II_USE_PETSC -template -void -DoFObjectAccessor<2,DoFHandler >::get_dof_values -(const PETScWrappers::Vector &, Vector&) const; -template -void -DoFObjectAccessor<2,DoFHandler >::get_dof_values -(const PETScWrappers::Vector &, Vector&) const; -template -void -DoFObjectAccessor<2,DoFHandler >::set_dof_values -(const Vector &, PETScWrappers::Vector&) const; -template -void -DoFObjectAccessor<2,DoFHandler >::set_dof_values -(const Vector&, PETScWrappers::Vector&) const; - -template -void -DoFObjectAccessor<2,DoFHandler >::get_dof_values -(const PETScWrappers::BlockVector &, Vector&) const; -template -void -DoFObjectAccessor<2,DoFHandler >::get_dof_values -(const PETScWrappers::BlockVector &, Vector&) const; -template -void -DoFObjectAccessor<2,DoFHandler >::set_dof_values -(const Vector &, PETScWrappers::BlockVector&) const; -template -void -DoFObjectAccessor<2,DoFHandler >::set_dof_values -(const Vector&, PETScWrappers::BlockVector&) const; -#endif -#endif - -#if deal_II_dimension >= 3 -template -void -DoFObjectAccessor<3,DoFHandler >::get_dof_values,double> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<3,DoFHandler >::set_dof_values,double> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<3,DoFHandler >::get_dof_values,float> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<3,DoFHandler >::set_dof_values,double> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<3,DoFHandler >::get_dof_values,double> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<3,DoFHandler >::set_dof_values,float> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<3,DoFHandler >::get_dof_values,float> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<3,DoFHandler >::set_dof_values,float> -(const Vector&, Vector&) const; - - - -// for block vector -template -void -DoFObjectAccessor<3,DoFHandler >::get_dof_values,double> -(const BlockVector&, Vector&) const; -template -void -DoFObjectAccessor<3,DoFHandler >::set_dof_values,double> -(const Vector&, BlockVector&) const; -template -void -DoFObjectAccessor<3,DoFHandler >::get_dof_values,float> -(const BlockVector&, Vector&) const; -template -void -DoFObjectAccessor<3,DoFHandler >::set_dof_values,double> -(const Vector&, BlockVector&) const; -template -void -DoFObjectAccessor<3,DoFHandler >::get_dof_values,double> -(const BlockVector&, Vector&) const; -template -void -DoFObjectAccessor<3,DoFHandler >::set_dof_values,float> -(const Vector&, BlockVector&) const; -template -void -DoFObjectAccessor<3,DoFHandler >::get_dof_values,float> -(const BlockVector&, Vector&) const; -template -void -DoFObjectAccessor<3,DoFHandler >::set_dof_values,float> -(const Vector&, BlockVector&) const; - -// for Petsc vectors -#if DEAL_II_USE_PETSC -template -void -DoFObjectAccessor<3,DoFHandler >::get_dof_values -(const PETScWrappers::Vector &, Vector&) const; -template -void -DoFObjectAccessor<3,DoFHandler >::get_dof_values -(const PETScWrappers::Vector &, Vector&) const; -template -void -DoFObjectAccessor<3,DoFHandler >::set_dof_values -(const Vector &, PETScWrappers::Vector&) const; -template -void -DoFObjectAccessor<3,DoFHandler >::set_dof_values -(const Vector&, PETScWrappers::Vector&) const; - -template -void -DoFObjectAccessor<3,DoFHandler >::get_dof_values -(const PETScWrappers::BlockVector &, Vector&) const; -template -void -DoFObjectAccessor<3,DoFHandler >::get_dof_values -(const PETScWrappers::BlockVector &, Vector&) const; -template -void -DoFObjectAccessor<3,DoFHandler >::set_dof_values -(const Vector &, PETScWrappers::BlockVector&) const; -template -void -DoFObjectAccessor<3,DoFHandler >::set_dof_values -(const Vector&, PETScWrappers::BlockVector&) const; -#endif -#endif - - + + template void @@ -1581,297 +1059,110 @@ template class TriaActiveIterator >::get_dof_values,double> +DoFCellAccessor >::get_dof_values,double> (const Vector&, Vector&) const; template void -DoFObjectAccessor<1,hp::DoFHandler >::set_dof_values,double> +DoFCellAccessor >::set_dof_values,double> (const Vector&, Vector&) const; template void -DoFObjectAccessor<1,hp::DoFHandler >::get_dof_values,float> +DoFCellAccessor >::get_dof_values,float> (const Vector&, Vector&) const; template void -DoFObjectAccessor<1,hp::DoFHandler >::set_dof_values,double> +DoFCellAccessor >::set_dof_values,double> (const Vector&, Vector&) const; template void -DoFObjectAccessor<1,hp::DoFHandler >::get_dof_values,double> +DoFCellAccessor >::get_dof_values,double> (const Vector&, Vector&) const; template void -DoFObjectAccessor<1,hp::DoFHandler >::set_dof_values,float> +DoFCellAccessor >::set_dof_values,float> (const Vector&, Vector&) const; template void -DoFObjectAccessor<1,hp::DoFHandler >::get_dof_values,float> +DoFCellAccessor >::get_dof_values,float> (const Vector&, Vector&) const; template void -DoFObjectAccessor<1,hp::DoFHandler >::set_dof_values,float> +DoFCellAccessor >::set_dof_values,float> (const Vector&, Vector&) const; // for block vector template void -DoFObjectAccessor<1,hp::DoFHandler >::get_dof_values,double> +DoFCellAccessor >::get_dof_values,double> (const BlockVector &, Vector&) const; template void -DoFObjectAccessor<1,hp::DoFHandler >::set_dof_values,double> +DoFCellAccessor >::set_dof_values,double> (const Vector&, BlockVector&) const; template void -DoFObjectAccessor<1,hp::DoFHandler >::get_dof_values,float> +DoFCellAccessor >::get_dof_values,float> (const BlockVector &, Vector&) const; template void -DoFObjectAccessor<1,hp::DoFHandler >::set_dof_values,double> +DoFCellAccessor >::set_dof_values,double> (const Vector&, BlockVector&) const; template void -DoFObjectAccessor<1,hp::DoFHandler >::get_dof_values,double> +DoFCellAccessor >::get_dof_values,double> (const BlockVector &, Vector&) const; template void -DoFObjectAccessor<1,hp::DoFHandler >::set_dof_values,float> -(const Vector&, BlockVector&) const; -template -void -DoFObjectAccessor<1,hp::DoFHandler >::get_dof_values,float> -(const BlockVector&, Vector&) const; -template -void -DoFObjectAccessor<1,hp::DoFHandler >::set_dof_values,float> -(const Vector&, BlockVector&) const; - -// for Petsc vectors -#if DEAL_II_USE_PETSC -template -void -DoFObjectAccessor<1,hp::DoFHandler >::get_dof_values -(const PETScWrappers::Vector &, Vector&) const; -template -void -DoFObjectAccessor<1,hp::DoFHandler >::get_dof_values -(const PETScWrappers::Vector &, Vector&) const; -template -void -DoFObjectAccessor<1,hp::DoFHandler >::set_dof_values -(const Vector &, PETScWrappers::Vector&) const; -template -void -DoFObjectAccessor<1,hp::DoFHandler >::set_dof_values -(const Vector&, PETScWrappers::Vector&) const; -#endif - - -#if deal_II_dimension >= 2 -template -void -DoFObjectAccessor<2,hp::DoFHandler >::get_dof_values,double> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<2,hp::DoFHandler >::set_dof_values,double> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<2,hp::DoFHandler >::get_dof_values,float> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<2,hp::DoFHandler >::set_dof_values,double> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<2,hp::DoFHandler >::get_dof_values,double> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<2,hp::DoFHandler >::set_dof_values,float> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<2,hp::DoFHandler >::get_dof_values,float> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<2,hp::DoFHandler >::set_dof_values,float> -(const Vector&, Vector&) const; - - -// for block vector -template -void -DoFObjectAccessor<2,hp::DoFHandler >::get_dof_values,double> -(const BlockVector&, Vector&) const; -template -void -DoFObjectAccessor<2,hp::DoFHandler >::set_dof_values,double> -(const Vector&, BlockVector&) const; -template -void -DoFObjectAccessor<2,hp::DoFHandler >::get_dof_values,float> -(const BlockVector&, Vector&) const; -template -void -DoFObjectAccessor<2,hp::DoFHandler >::set_dof_values,double> -(const Vector&, BlockVector&) const; -template -void -DoFObjectAccessor<2,hp::DoFHandler >::get_dof_values,double> -(const BlockVector&, Vector&) const; -template -void -DoFObjectAccessor<2,hp::DoFHandler >::set_dof_values,float> -(const Vector&, BlockVector&) const; -template -void -DoFObjectAccessor<2,hp::DoFHandler >::get_dof_values,float> -(const BlockVector&, Vector&) const; -template -void -DoFObjectAccessor<2,hp::DoFHandler >::set_dof_values,float> -(const Vector&, BlockVector&) const; - -// for Petsc vectors -#if DEAL_II_USE_PETSC -template -void -DoFObjectAccessor<2,hp::DoFHandler >::get_dof_values -(const PETScWrappers::Vector &, Vector&) const; -template -void -DoFObjectAccessor<2,hp::DoFHandler >::get_dof_values -(const PETScWrappers::Vector &, Vector&) const; -template -void -DoFObjectAccessor<2,hp::DoFHandler >::set_dof_values -(const Vector &, PETScWrappers::Vector&) const; -template -void -DoFObjectAccessor<2,hp::DoFHandler >::set_dof_values -(const Vector&, PETScWrappers::Vector&) const; -#endif - -#endif - -#if deal_II_dimension >= 3 -// for double -template -void -DoFObjectAccessor<3,hp::DoFHandler >::get_dof_values,double> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<3,hp::DoFHandler >::set_dof_values,double> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<3,hp::DoFHandler >::get_dof_values,float> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<3,hp::DoFHandler >::set_dof_values,double> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<3,hp::DoFHandler >::get_dof_values,double> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<3,hp::DoFHandler >::set_dof_values,float> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<3,hp::DoFHandler >::get_dof_values,float> -(const Vector&, Vector&) const; -template -void -DoFObjectAccessor<3,hp::DoFHandler >::set_dof_values,float> -(const Vector&, Vector&) const; - - - -// for block vector -template -void -DoFObjectAccessor<3,hp::DoFHandler >::get_dof_values,double> -(const BlockVector&, Vector&) const; -template -void -DoFObjectAccessor<3,hp::DoFHandler >::set_dof_values,double> -(const Vector&, BlockVector&) const; -template -void -DoFObjectAccessor<3,hp::DoFHandler >::get_dof_values,float> -(const BlockVector&, Vector&) const; -template -void -DoFObjectAccessor<3,hp::DoFHandler >::set_dof_values,double> -(const Vector&, BlockVector&) const; -template -void -DoFObjectAccessor<3,hp::DoFHandler >::get_dof_values,double> -(const BlockVector&, Vector&) const; -template -void -DoFObjectAccessor<3,hp::DoFHandler >::set_dof_values,float> +DoFCellAccessor >::set_dof_values,float> (const Vector&, BlockVector&) const; template void -DoFObjectAccessor<3,hp::DoFHandler >::get_dof_values,float> +DoFCellAccessor >::get_dof_values,float> (const BlockVector&, Vector&) const; template void -DoFObjectAccessor<3,hp::DoFHandler >::set_dof_values,float> +DoFCellAccessor >::set_dof_values,float> (const Vector&, BlockVector&) const; - // for Petsc vectors #ifdef DEAL_II_USE_PETSC template void -DoFObjectAccessor<3,hp::DoFHandler >::get_dof_values +DoFCellAccessor >::get_dof_values (const PETScWrappers::Vector &, Vector&) const; template void -DoFObjectAccessor<3,hp::DoFHandler >::get_dof_values +DoFCellAccessor >::get_dof_values (const PETScWrappers::Vector &, Vector&) const; template void -DoFObjectAccessor<3,hp::DoFHandler >::set_dof_values +DoFCellAccessor >::set_dof_values (const Vector &, PETScWrappers::Vector&) const; template void -DoFObjectAccessor<3,hp::DoFHandler >::set_dof_values +DoFCellAccessor >::set_dof_values (const Vector&, PETScWrappers::Vector&) const; template void -DoFObjectAccessor<3,hp::DoFHandler >::get_dof_values +DoFCellAccessor >::get_dof_values (const PETScWrappers::BlockVector &, Vector&) const; template void -DoFObjectAccessor<3,hp::DoFHandler >::get_dof_values +DoFCellAccessor >::get_dof_values (const PETScWrappers::BlockVector &, Vector&) const; template void -DoFObjectAccessor<3,hp::DoFHandler >::set_dof_values -(const Vector&, PETScWrappers::BlockVector &) const; +DoFCellAccessor >::set_dof_values +(const Vector &, PETScWrappers::BlockVector&) const; template void -DoFObjectAccessor<3,hp::DoFHandler >::set_dof_values +DoFCellAccessor >::set_dof_values (const Vector&, PETScWrappers::BlockVector&) const; #endif -#endif - template diff --git a/deal.II/doc/news/changes.html b/deal.II/doc/news/changes.html index 9c4dc4d662..847fbf5657 100644 --- a/deal.II/doc/news/changes.html +++ b/deal.II/doc/news/changes.html @@ -635,12 +635,28 @@ inconvenience this causes.

deal.II

    +
  1. + Changed: The DoFObjectAccessor::get_dof_values and + DoFObjectAccessor::set_dof_values were part of the + accessors for lines, quads, and hexes. However, they could not + be called for these objects unless the object was actually a + cell, i.e. one could never call this function for a line or + face in 3d, for example. The functions have therefore been + moved to the DoFCellAccessor class that provides + access to cells (i.e. lines in 1d, quads in 2d, and hexes in + 3d) for which this operation is actually useful. +
    + (WB 2006/05/01) +

  2. Fixed: second derivatives where not computed correctly in FEFaceValuesBase. -
    - (GK 2006/04/28) -

    + class="class">FEFaceValuesBase, i.e. when evaluating + second derivatives on faces of cells. This is now fixed. Using + second derivatives evaluated at quadrature points within a cell + was not affected by this problem. +
    + (GK 2006/04/28) +

  3. New: The functions Triangulation::clear_user_flags_line, -- 2.39.5