From: buerg Date: Wed, 8 Aug 2012 17:06:35 +0000 (+0000) Subject: Add merge. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba220b267e9de989210836dc6676ef38401f39c1;p=dealii-svn.git Add merge. git-svn-id: https://svn.dealii.org/branches/branch_merge_mg_into_dof_handler@25783 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/dofs/block_info.h b/deal.II/include/deal.II/dofs/block_info.h index 68448578e3..a8a874055a 100644 --- a/deal.II/include/deal.II/dofs/block_info.h +++ b/deal.II/include/deal.II/dofs/block_info.h @@ -98,7 +98,7 @@ class BlockInfo : public Subscriptor * the local() indices. */ template - void initialize(const DoFHandler&); + void initialize(const DoFHandler&, bool levels_only = false, bool multigrid = false); /** * @brief Fill the object with values @@ -180,7 +180,7 @@ class BlockInfo : public Subscriptor template void print(OS& stream) const; - + /** * Determine an estimate for the * memory consumption (in bytes) @@ -305,15 +305,15 @@ BlockInfo::print (OS& os) const { os << "local dofs " << std::setw(5) << local().total_size() << " blocks"; for (unsigned int i=0;i BaseClass; + typedef dealii::TriaAccessor BaseClass; }; @@ -109,7 +109,7 @@ namespace internal * See the full documentation for * more information. */ - typedef dealii::CellAccessor BaseClass; + typedef dealii::CellAccessor BaseClass; }; } } @@ -223,9 +223,9 @@ class DoFAccessor : public dealii::internal::DoFAccessor::Inheritance *tria, - const int level, - const int index, - const DH *local_data); + const int level, + const int index, + const DH *local_data); /** * Conversion constructor. This @@ -405,7 +405,9 @@ class DoFAccessor : public dealii::internal::DoFAccessor::Inheritance &dof_indices, - const unsigned int fe_index = DH::default_fe_index) const; + const unsigned int fe_index = DH::default_fe_index) const; + + void get_mg_dof_indices (const int level, std::vector& dof_indices, const unsigned int fe_index = DH::default_fe_index) const; /** * Global DoF index of the i @@ -444,8 +446,10 @@ class DoFAccessor : public dealii::internal::DoFAccessor::Inheritanceith degree @@ -502,7 +506,9 @@ class DoFAccessor : public dealii::internal::DoFAccessor::Inheritancei @@ -729,9 +737,11 @@ class DoFAccessor : public dealii::internal::DoFAccessor::Inheritance > : public TriaAccessor<0,1,spacedim> * triangulations. */ DoFAccessor (const Triangulation<1,spacedim> * tria, - const typename TriaAccessor<0,1,spacedim>::VertexKind vertex_kind, - const unsigned int vertex_index, - const DH<1,spacedim> * dof_handler); + const typename TriaAccessor<0,1,spacedim>::VertexKind vertex_kind, + const unsigned int vertex_index, + const DH<1,spacedim> * dof_handler); /** * Constructor. This constructor @@ -881,9 +891,9 @@ class DoFAccessor<0,DH<1,spacedim> > : public TriaAccessor<0,1,spacedim> * may not actually be called. */ DoFAccessor (const Triangulation<1,spacedim> *, - const int = 0, - const int = 0, - const DH<1,spacedim> * = 0); + const int = 0, + const int = 0, + const DH<1,spacedim> * = 0); /** * Conversion constructor. This @@ -1069,7 +1079,7 @@ class DoFAccessor<0,DH<1,spacedim> > : public TriaAccessor<0,1,spacedim> * as last argument. */ void get_dof_indices (std::vector &dof_indices, - const unsigned int fe_index = AccessorData::default_fe_index) const; + const unsigned int fe_index = AccessorData::default_fe_index) const; /** * Global DoF index of the i @@ -1108,8 +1118,8 @@ class DoFAccessor<0,DH<1,spacedim> > : public TriaAccessor<0,1,spacedim> * active_fe_index(). */ unsigned int vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index = AccessorData::default_fe_index) const; + const unsigned int i, + const unsigned int fe_index = AccessorData::default_fe_index) const; /** * Index of the ith degree @@ -1166,7 +1176,7 @@ class DoFAccessor<0,DH<1,spacedim> > : public TriaAccessor<0,1,spacedim> * the face. */ unsigned int dof_index (const unsigned int i, - const unsigned int fe_index = AccessorData::default_fe_index) const; + const unsigned int fe_index = AccessorData::default_fe_index) const; /** * @} @@ -1353,8 +1363,8 @@ class DoFAccessor<0,DH<1,spacedim> > : public TriaAccessor<0,1,spacedim> * active_fe_index(). */ void set_dof_index (const unsigned int i, - const unsigned int index, - const unsigned int fe_index = AccessorData::default_fe_index) const; + const unsigned int index, + const unsigned int fe_index = AccessorData::default_fe_index) const; /** * Set the global index of the i @@ -1393,9 +1403,9 @@ class DoFAccessor<0,DH<1,spacedim> > : public TriaAccessor<0,1,spacedim> * active_fe_index(). */ void set_vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int index, - const unsigned int fe_index = AccessorData::default_fe_index) const; + const unsigned int i, + const unsigned int index, + const unsigned int fe_index = AccessorData::default_fe_index) const; /** * Iterator classes need to be friends @@ -1482,9 +1492,9 @@ class DoFCellAccessor : public DoFAccessor * Constructor */ DoFCellAccessor (const Triangulation *tria, - const int level, - const int index, - const AccessorData *local_data); + const int level, + const int index, + const AccessorData *local_data); /** * Conversion constructor. This @@ -1523,7 +1533,7 @@ class DoFCellAccessor : public DoFAccessor * @} */ - /** + /** * Return the parent as a DoF * cell iterator. This * function is needed since the @@ -1633,7 +1643,7 @@ class DoFCellAccessor : public DoFAccessor */ template void get_dof_values (const InputVector &values, - Vector &local_values) const; + Vector &local_values) const; /** * Return the values of the given vector @@ -1665,8 +1675,8 @@ class DoFCellAccessor : public DoFAccessor */ template void get_dof_values (const InputVector &values, - ForwardIterator local_values_begin, - ForwardIterator local_values_end) const; + ForwardIterator local_values_begin, + ForwardIterator local_values_end) const; /** * Return the values of the given vector @@ -1701,9 +1711,9 @@ class DoFCellAccessor : public DoFAccessor */ template void get_dof_values (const ConstraintMatrix &constraints, - const InputVector &values, - ForwardIterator local_values_begin, - ForwardIterator local_values_end) const; + const InputVector &values, + ForwardIterator local_values_begin, + ForwardIterator local_values_end) const; /** * This function is the counterpart to @@ -1741,7 +1751,7 @@ class DoFCellAccessor : public DoFAccessor */ template void set_dof_values (const Vector &local_values, - OutputVector &values) const; + OutputVector &values) const; /** * Return the interpolation of @@ -1777,7 +1787,7 @@ class DoFCellAccessor : public DoFAccessor */ template void get_interpolated_dof_values (const InputVector &values, - Vector &interpolated_values) const; + Vector &interpolated_values) const; /** * This, again, is the @@ -1870,7 +1880,7 @@ class DoFCellAccessor : public DoFAccessor */ template void set_dof_values_by_interpolation (const Vector &local_values, - OutputVector &values) const; + OutputVector &values) const; /** * Distribute a local (cell @@ -1909,8 +1919,8 @@ class DoFCellAccessor : public DoFAccessor template void distribute_local_to_global (ForwardIterator local_source_begin, - ForwardIterator local_source_end, - OutputVector &global_destination) const; + ForwardIterator local_source_end, + OutputVector &global_destination) const; /** * Distribute a local (cell based) @@ -1934,8 +1944,8 @@ class DoFCellAccessor : public DoFAccessor void distribute_local_to_global (const ConstraintMatrix &constraints, ForwardIterator local_source_begin, - ForwardIterator local_source_end, - OutputVector &global_destination) const; + ForwardIterator local_source_end, + OutputVector &global_destination) const; /** * This function does much the @@ -1962,9 +1972,9 @@ class DoFCellAccessor : public DoFAccessor template void distribute_local_to_global (const FullMatrix &local_matrix, - const Vector &local_vector, + const Vector &local_vector, OutputMatrix &global_matrix, - OutputVector &global_vector) const; + OutputVector &global_vector) const; /** * @} @@ -2023,6 +2033,8 @@ class DoFCellAccessor : public DoFAccessor * with them at all. */ void get_dof_indices (std::vector &dof_indices) const; + + void get_mg_dof_indices (std::vector& dof_indices) const; /** * @} diff --git a/deal.II/include/deal.II/dofs/dof_accessor.templates.h b/deal.II/include/deal.II/dofs/dof_accessor.templates.h index dedeae9968..07360dc63a 100644 --- a/deal.II/include/deal.II/dofs/dof_accessor.templates.h +++ b/deal.II/include/deal.II/dofs/dof_accessor.templates.h @@ -47,11 +47,11 @@ DoFAccessor::DoFAccessor ( const int level, const int index, const DH *dof_handler) - : - dealii::internal::DoFAccessor::Inheritance::BaseClass (tria, - level, - index), + level, + index), dof_handler(const_cast(dof_handler)) {} @@ -157,17 +157,17 @@ DoFAccessor::child (const unsigned int i) const next_level = 0; TriaIterator > q (this->tria, - next_level, - this->child_index (i), - this->dof_handler); + next_level, + this->child_index (i), + this->dof_handler); // make sure that we either created // a past-the-end iterator or one // pointing to a used cell Assert ((q.state() == IteratorState::past_the_end) - || - q->used(), - TriaAccessorExceptions::ExcUnusedCellAsChild()); + || + q->used(), + TriaAccessorExceptions::ExcUnusedCellAsChild()); return q; } @@ -192,9 +192,9 @@ DoFAccessor::parent () const previous_level = 0; TriaIterator > q (this->tria, - previous_level, - this->parent_index (), - this->dof_handler); + previous_level, + this->parent_index (), + this->dof_handler); return q; } @@ -216,510 +216,510 @@ namespace internal * Implementations of the * get_dof_index/set_dof_index functions. */ - template - static - unsigned int - get_dof_index (const dealii::DoFHandler<1,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - dealii::internal::int2type<1>) - { - return dof_handler.levels[obj_level]->lines. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index); - } - - - template - static - void - set_dof_index (const dealii::DoFHandler<1,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - dealii::internal::int2type<1>, - const unsigned int global_index) - { - dof_handler.levels[obj_level]->lines. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index); - } - - - template - static - unsigned int - get_dof_index (const dealii::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - dealii::internal::int2type<1>) - { + template + static + unsigned int + get_dof_index (const dealii::DoFHandler<1,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + dealii::internal::int2type<1>) + { + return dof_handler.levels[obj_level]->lines. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index); + } + + + template + static + void + set_dof_index (const dealii::DoFHandler<1,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + dealii::internal::int2type<1>, + const unsigned int global_index) + { + dof_handler.levels[obj_level]->lines. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index); + } + + + template + static + unsigned int + get_dof_index (const dealii::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + dealii::internal::int2type<1>) + { // faces have no levels - Assert (obj_level == 0, ExcInternalError()); - return dof_handler.faces->lines. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index); - } - - - template - static - void - set_dof_index (const dealii::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - dealii::internal::int2type<1>, - const unsigned int global_index) - { + Assert (obj_level == 0, ExcInternalError()); + return dof_handler.faces->lines. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index); + } + + + template + static + void + set_dof_index (const dealii::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + dealii::internal::int2type<1>, + const unsigned int global_index) + { // faces have no levels - Assert (obj_level == 0, ExcInternalError()); - dof_handler.faces->lines. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index); - } - - - template - static - unsigned int - get_dof_index (const dealii::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - dealii::internal::int2type<2>) - { - return dof_handler.levels[obj_level]->quads. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index); - } - - - template - static - void - set_dof_index (const dealii::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - dealii::internal::int2type<2>, - const unsigned int global_index) - { - dof_handler.levels[obj_level]->quads. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index); - } - - - template - static - unsigned int - get_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - dealii::internal::int2type<1>) - { + Assert (obj_level == 0, ExcInternalError()); + dof_handler.faces->lines. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index); + } + + + template + static + unsigned int + get_dof_index (const dealii::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + dealii::internal::int2type<2>) + { + return dof_handler.levels[obj_level]->quads. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index); + } + + + template + static + void + set_dof_index (const dealii::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + dealii::internal::int2type<2>, + const unsigned int global_index) + { + dof_handler.levels[obj_level]->quads. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index); + } + + + template + static + unsigned int + get_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + dealii::internal::int2type<1>) + { // faces have no levels - Assert (obj_level == 0, ExcInternalError()); - return dof_handler.faces->lines. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index); - } - - - template - static - void - set_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - dealii::internal::int2type<1>, - const unsigned int global_index) - { + Assert (obj_level == 0, ExcInternalError()); + return dof_handler.faces->lines. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index); + } + + + template + static + void + set_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + dealii::internal::int2type<1>, + const unsigned int global_index) + { // faces have no levels - Assert (obj_level == 0, ExcInternalError()); - dof_handler.faces->lines. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index); - } - - - - template - static - unsigned int - get_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - dealii::internal::int2type<2>) - { + Assert (obj_level == 0, ExcInternalError()); + dof_handler.faces->lines. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index); + } + + + + template + static + unsigned int + get_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + dealii::internal::int2type<2>) + { // faces have no levels - Assert (obj_level == 0, ExcInternalError()); - return dof_handler.faces->quads. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index); - } - - - template - static - void - set_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - dealii::internal::int2type<2>, - const unsigned int global_index) - { + Assert (obj_level == 0, ExcInternalError()); + return dof_handler.faces->quads. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index); + } + + + template + static + void + set_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + dealii::internal::int2type<2>, + const unsigned int global_index) + { // faces have no levels - Assert (obj_level == 0, ExcInternalError()); - dof_handler.faces->quads. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index); - } - - - - template - static - unsigned int - get_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - dealii::internal::int2type<3>) - { - return dof_handler.levels[obj_level]->hexes. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index); - } - - - template - static - void - set_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - dealii::internal::int2type<3>, - const unsigned int global_index) - { - dof_handler.levels[obj_level]->hexes. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index); - } - - - template - static - unsigned int - get_dof_index (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const dealii::internal::int2type<1> &) - { - return dof_handler.levels[obj_level]->lines. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - obj_level); - } - - - template - static - void - set_dof_index (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const dealii::internal::int2type<1> &, - const unsigned int global_index) - { - dof_handler.levels[obj_level]->lines. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index, - obj_level); - } - - - template - static - unsigned int - get_dof_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const dealii::internal::int2type<1> &) - { - return dof_handler.faces->lines. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - obj_level); - } - - - template - static - void - set_dof_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const dealii::internal::int2type<1> &, - const unsigned int global_index) - { - dof_handler.faces->lines. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index, - obj_level); - } - - - template - static - unsigned int - get_dof_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const dealii::internal::int2type<2> &) - { - return dof_handler.levels[obj_level]->quads. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - obj_level); - } - - - template - static - void - set_dof_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const dealii::internal::int2type<2> &, - const unsigned int global_index) - { - dof_handler.levels[obj_level]->quads. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index, - obj_level); - } - - - template - static - unsigned int - get_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const dealii::internal::int2type<1> &) - { - return dof_handler.faces->lines. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - obj_level); - } - - - template - static - void - set_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const dealii::internal::int2type<1> &, - const unsigned int global_index) - { - dof_handler.faces->lines. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index, - obj_level); - } - - - template - static - unsigned int - get_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const dealii::internal::int2type<2> &) - { - return dof_handler.faces->quads. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - obj_level); - } - - - template - static - void - set_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const dealii::internal::int2type<2> &, - const unsigned int global_index) - { - dof_handler.faces->quads. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index, - obj_level); - } - - - template - static - unsigned int - get_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const dealii::internal::int2type<3> &) - { - return dof_handler.levels[obj_level]->hexes. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - obj_level); - } - - - template - static - void - set_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const dealii::internal::int2type<3> &, - const unsigned int global_index) - { - dof_handler.levels[obj_level]->hexes. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index, - obj_level); - } - - - template - static - bool - fe_index_is_active (const dealii::DoFHandler &, - const unsigned int, - const unsigned int, - const unsigned int fe_index, - const dealii::internal::int2type &) - { - return (fe_index == 0); - } - - - - template - static - unsigned int - n_active_fe_indices (const dealii::DoFHandler &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const dealii::internal::int2type &) - { + Assert (obj_level == 0, ExcInternalError()); + dof_handler.faces->quads. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index); + } + + + + template + static + unsigned int + get_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + dealii::internal::int2type<3>) + { + return dof_handler.levels[obj_level]->hexes. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index); + } + + + template + static + void + set_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + dealii::internal::int2type<3>, + const unsigned int global_index) + { + dof_handler.levels[obj_level]->hexes. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index); + } + + + template + static + unsigned int + get_dof_index (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const dealii::internal::int2type<1> &) + { + return dof_handler.levels[obj_level]->lines. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + obj_level); + } + + + template + static + void + set_dof_index (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const dealii::internal::int2type<1> &, + const unsigned int global_index) + { + dof_handler.levels[obj_level]->lines. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index, + obj_level); + } + + + template + static + unsigned int + get_dof_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const dealii::internal::int2type<1> &) + { + return dof_handler.faces->lines. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + obj_level); + } + + + template + static + void + set_dof_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const dealii::internal::int2type<1> &, + const unsigned int global_index) + { + dof_handler.faces->lines. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index, + obj_level); + } + + + template + static + unsigned int + get_dof_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const dealii::internal::int2type<2> &) + { + return dof_handler.levels[obj_level]->quads. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + obj_level); + } + + + template + static + void + set_dof_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const dealii::internal::int2type<2> &, + const unsigned int global_index) + { + dof_handler.levels[obj_level]->quads. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index, + obj_level); + } + + + template + static + unsigned int + get_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const dealii::internal::int2type<1> &) + { + return dof_handler.faces->lines. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + obj_level); + } + + + template + static + void + set_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const dealii::internal::int2type<1> &, + const unsigned int global_index) + { + dof_handler.faces->lines. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index, + obj_level); + } + + + template + static + unsigned int + get_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const dealii::internal::int2type<2> &) + { + return dof_handler.faces->quads. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + obj_level); + } + + + template + static + void + set_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const dealii::internal::int2type<2> &, + const unsigned int global_index) + { + dof_handler.faces->quads. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index, + obj_level); + } + + + template + static + unsigned int + get_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const dealii::internal::int2type<3> &) + { + return dof_handler.levels[obj_level]->hexes. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + obj_level); + } + + + template + static + void + set_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const dealii::internal::int2type<3> &, + const unsigned int global_index) + { + dof_handler.levels[obj_level]->hexes. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index, + obj_level); + } + + + template + static + bool + fe_index_is_active (const dealii::DoFHandler &, + const unsigned int, + const unsigned int, + const unsigned int fe_index, + const dealii::internal::int2type &) + { + return (fe_index == 0); + } + + + + template + static + unsigned int + n_active_fe_indices (const dealii::DoFHandler &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const dealii::internal::int2type &) + { // check that the object we look // at is in fact active. the // problem is that we have @@ -734,42 +734,42 @@ namespace internal // leaves out is faces in 3d -- // let's hope that this never is // a problem - Assert ((dim==structdim - ? - typename - dealii::DoFHandler:: - raw_cell_iterator (&dof_handler.get_tria(), - obj_level, - obj_index, - &dof_handler)->used() - : - (structdim==1 - ? - typename - dealii::DoFHandler:: - raw_line_iterator (&dof_handler.get_tria(), - obj_level, - obj_index, - &dof_handler)->used() - : - true)) - == true, - ExcMessage ("This cell is not active and therefore can't be " - "queried for its active FE indices")); - return 1; - } - - - - template - static - unsigned int - nth_active_fe_index (const dealii::DoFHandler &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n, - const dealii::internal::int2type &) - { + Assert ((dim==structdim + ? + typename + dealii::DoFHandler:: + raw_cell_iterator (&dof_handler.get_tria(), + obj_level, + obj_index, + &dof_handler)->used() + : + (structdim==1 + ? + typename + dealii::DoFHandler:: + raw_line_iterator (&dof_handler.get_tria(), + obj_level, + obj_index, + &dof_handler)->used() + : + true)) + == true, + ExcMessage ("This cell is not active and therefore can't be " + "queried for its active FE indices")); + return 1; + } + + + + template + static + unsigned int + nth_active_fe_index (const dealii::DoFHandler &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int n, + const dealii::internal::int2type &) + { // check that the object we look // at is in fact active. the // problem is that we have @@ -784,310 +784,310 @@ namespace internal // leaves out is faces in 3d -- // let's hope that this never is // a problem - Assert ((dim==structdim - ? - typename - dealii::DoFHandler:: - raw_cell_iterator (&dof_handler.get_tria(), - obj_level, - obj_index, - &dof_handler)->used() - : - (structdim==1 - ? - typename - dealii::DoFHandler:: - raw_line_iterator (&dof_handler.get_tria(), - obj_level, - obj_index, - &dof_handler)->used() - : - true)) - == true, - ExcMessage ("This cell is not active and therefore can't be " - "queried for its active FE indices")); - Assert (n == 0, ExcIndexRange (n, 0, 1)); - - return dealii::DoFHandler::default_fe_index; - } - - - template - static - bool - fe_index_is_active (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const dealii::internal::int2type<1> &) - { - return dof_handler.levels[obj_level]->lines.fe_index_is_active(dof_handler, - obj_index, - fe_index, - obj_level); - } - - - template - static - unsigned int - n_active_fe_indices (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const dealii::internal::int2type<1> &) - { - return dof_handler.levels[obj_level]->lines.n_active_fe_indices (dof_handler, - obj_index); - } - - - - template - static - unsigned int - nth_active_fe_index (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n, - const dealii::internal::int2type<1> &) - { - return dof_handler.levels[obj_level]->lines.nth_active_fe_index (dof_handler, - obj_level, - obj_index, - n); - } - - - template - static - bool - fe_index_is_active (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const dealii::internal::int2type<1> &) - { - return dof_handler.faces->lines.fe_index_is_active(dof_handler, - obj_index, - fe_index, - obj_level); - } - - - template - static - unsigned int - n_active_fe_indices (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, - const unsigned int , - const unsigned int obj_index, - const dealii::internal::int2type<1> &) - { - return dof_handler.faces->lines.n_active_fe_indices (dof_handler, - obj_index); - } - - - template - static - unsigned int - nth_active_fe_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n, - const dealii::internal::int2type<1> &) - { - return dof_handler.faces->lines.nth_active_fe_index (dof_handler, - obj_level, - obj_index, - n); - } - - - - template - static - bool - fe_index_is_active (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const dealii::internal::int2type<2> &) - { - return dof_handler.levels[obj_level]->quads.fe_index_is_active(dof_handler, - obj_index, - fe_index, - obj_level); - } - - - template - static - unsigned int - n_active_fe_indices (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const dealii::internal::int2type<2> &) - { - return dof_handler.levels[obj_level]->quads.n_active_fe_indices (dof_handler, - obj_index); - } - - - - template - static - unsigned int - nth_active_fe_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n, - const dealii::internal::int2type<2> &) - { - return dof_handler.levels[obj_level]->quads.nth_active_fe_index (dof_handler, - obj_level, - obj_index, - n); - } - - - - template - static - bool - fe_index_is_active (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const dealii::internal::int2type<1> &) - { - return dof_handler.faces->lines.fe_index_is_active(dof_handler, - obj_index, - fe_index, - obj_level); - } - - - template - static - unsigned int - n_active_fe_indices (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int, - const unsigned int obj_index, - const dealii::internal::int2type<1> &) - { - return dof_handler.faces->lines.n_active_fe_indices (dof_handler, - obj_index); - } - - - - template - static - unsigned int - nth_active_fe_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n, - const dealii::internal::int2type<1> &) - { - return dof_handler.faces->lines.nth_active_fe_index (dof_handler, - obj_level, - obj_index, - n); - } - - - - template - static - bool - fe_index_is_active (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const dealii::internal::int2type<2> &) - { - return dof_handler.faces->quads.fe_index_is_active(dof_handler, - obj_index, - fe_index, - obj_level); - } - - template - static - bool - fe_index_is_active (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const dealii::internal::int2type<3> &) - { - return dof_handler.levels[obj_level]->hexes.fe_index_is_active(dof_handler, - obj_index, - fe_index, - obj_level); - } - - - template - static - unsigned int - n_active_fe_indices (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int , - const unsigned int obj_index, - const dealii::internal::int2type<2> &) - { - return dof_handler.faces->quads.n_active_fe_indices (dof_handler, - obj_index); - } - - - - template - static - unsigned int - nth_active_fe_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n, - const dealii::internal::int2type<2> &) - { - return dof_handler.faces->quads.nth_active_fe_index (dof_handler, - obj_level, - obj_index, - n); - } - - - - template - static - unsigned int - n_active_fe_indices (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const dealii::internal::int2type<3> &) - { - return dof_handler.levels[obj_level]->hexes.n_active_fe_indices (dof_handler, - obj_index); - } - - - - template - static - unsigned int - nth_active_fe_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n, - const dealii::internal::int2type<3> &) - { - return dof_handler.levels[obj_level]->hexes.nth_active_fe_index (dof_handler, - obj_level, - obj_index, - n); - } + Assert ((dim==structdim + ? + typename + dealii::DoFHandler:: + raw_cell_iterator (&dof_handler.get_tria(), + obj_level, + obj_index, + &dof_handler)->used() + : + (structdim==1 + ? + typename + dealii::DoFHandler:: + raw_line_iterator (&dof_handler.get_tria(), + obj_level, + obj_index, + &dof_handler)->used() + : + true)) + == true, + ExcMessage ("This cell is not active and therefore can't be " + "queried for its active FE indices")); + Assert (n == 0, ExcIndexRange (n, 0, 1)); + + return dealii::DoFHandler::default_fe_index; + } + + + template + static + bool + fe_index_is_active (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const dealii::internal::int2type<1> &) + { + return dof_handler.levels[obj_level]->lines.fe_index_is_active(dof_handler, + obj_index, + fe_index, + obj_level); + } + + + template + static + unsigned int + n_active_fe_indices (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const dealii::internal::int2type<1> &) + { + return dof_handler.levels[obj_level]->lines.n_active_fe_indices (dof_handler, + obj_index); + } + + + + template + static + unsigned int + nth_active_fe_index (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int n, + const dealii::internal::int2type<1> &) + { + return dof_handler.levels[obj_level]->lines.nth_active_fe_index (dof_handler, + obj_level, + obj_index, + n); + } + + + template + static + bool + fe_index_is_active (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const dealii::internal::int2type<1> &) + { + return dof_handler.faces->lines.fe_index_is_active(dof_handler, + obj_index, + fe_index, + obj_level); + } + + + template + static + unsigned int + n_active_fe_indices (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int , + const unsigned int obj_index, + const dealii::internal::int2type<1> &) + { + return dof_handler.faces->lines.n_active_fe_indices (dof_handler, + obj_index); + } + + + template + static + unsigned int + nth_active_fe_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int n, + const dealii::internal::int2type<1> &) + { + return dof_handler.faces->lines.nth_active_fe_index (dof_handler, + obj_level, + obj_index, + n); + } + + + + template + static + bool + fe_index_is_active (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const dealii::internal::int2type<2> &) + { + return dof_handler.levels[obj_level]->quads.fe_index_is_active(dof_handler, + obj_index, + fe_index, + obj_level); + } + + + template + static + unsigned int + n_active_fe_indices (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const dealii::internal::int2type<2> &) + { + return dof_handler.levels[obj_level]->quads.n_active_fe_indices (dof_handler, + obj_index); + } + + + + template + static + unsigned int + nth_active_fe_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int n, + const dealii::internal::int2type<2> &) + { + return dof_handler.levels[obj_level]->quads.nth_active_fe_index (dof_handler, + obj_level, + obj_index, + n); + } + + + + template + static + bool + fe_index_is_active (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const dealii::internal::int2type<1> &) + { + return dof_handler.faces->lines.fe_index_is_active(dof_handler, + obj_index, + fe_index, + obj_level); + } + + + template + static + unsigned int + n_active_fe_indices (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int, + const unsigned int obj_index, + const dealii::internal::int2type<1> &) + { + return dof_handler.faces->lines.n_active_fe_indices (dof_handler, + obj_index); + } + + + + template + static + unsigned int + nth_active_fe_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int n, + const dealii::internal::int2type<1> &) + { + return dof_handler.faces->lines.nth_active_fe_index (dof_handler, + obj_level, + obj_index, + n); + } + + + + template + static + bool + fe_index_is_active (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const dealii::internal::int2type<2> &) + { + return dof_handler.faces->quads.fe_index_is_active(dof_handler, + obj_index, + fe_index, + obj_level); + } + + template + static + bool + fe_index_is_active (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const dealii::internal::int2type<3> &) + { + return dof_handler.levels[obj_level]->hexes.fe_index_is_active(dof_handler, + obj_index, + fe_index, + obj_level); + } + + + template + static + unsigned int + n_active_fe_indices (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int , + const unsigned int obj_index, + const dealii::internal::int2type<2> &) + { + return dof_handler.faces->quads.n_active_fe_indices (dof_handler, + obj_index); + } + + + + template + static + unsigned int + nth_active_fe_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int n, + const dealii::internal::int2type<2> &) + { + return dof_handler.faces->quads.nth_active_fe_index (dof_handler, + obj_level, + obj_index, + n); + } + + + + template + static + unsigned int + n_active_fe_indices (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const dealii::internal::int2type<3> &) + { + return dof_handler.levels[obj_level]->hexes.n_active_fe_indices (dof_handler, + obj_index); + } + + + + template + static + unsigned int + nth_active_fe_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int n, + const dealii::internal::int2type<3> &) + { + return dof_handler.levels[obj_level]->hexes.nth_active_fe_index (dof_handler, + obj_level, + obj_index, + n); + } /** * Set the @p local_index-th @@ -1099,54 +1099,54 @@ namespace internal * vertex_index to @p * global_index. */ - template - static - void - set_vertex_dof_index (dealii::DoFHandler &dof_handler, - const unsigned int vertex_index, - const unsigned int fe_index, - const unsigned int local_index, - const unsigned int global_index) - { - Assert ((fe_index == dealii::DoFHandler::default_fe_index), - ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); - Assert (dof_handler.selected_fe != 0, - ExcMessage ("No finite element collection is associated with " - "this DoFHandler")); - Assert (local_index < dof_handler.selected_fe->dofs_per_vertex, - ExcIndexRange(local_index, 0, - dof_handler.selected_fe->dofs_per_vertex)); - - dof_handler.vertex_dofs[vertex_index * - dof_handler.selected_fe->dofs_per_vertex - + local_index] - = global_index; - } - - - template - static - void - set_vertex_dof_index (dealii::hp::DoFHandler &dof_handler, - const unsigned int vertex_index, - const unsigned int fe_index, - const unsigned int local_index, - const unsigned int global_index) - { - Assert ( (fe_index != dealii::hp::DoFHandler::default_fe_index), - ExcMessage ("You need to specify a FE index when working " - "with hp DoFHandlers")); - Assert (dof_handler.finite_elements != 0, - ExcMessage ("No finite element collection is associated with " - "this DoFHandler")); - Assert (local_index < (*dof_handler.finite_elements)[fe_index].dofs_per_vertex, - ExcIndexRange(local_index, 0, - (*dof_handler.finite_elements)[fe_index].dofs_per_vertex)); - Assert (fe_index < dof_handler.finite_elements->size(), - ExcInternalError()); - Assert (dof_handler.vertex_dofs_offsets[vertex_index] != - numbers::invalid_unsigned_int, - ExcMessage ("This vertex is unused and has no DoFs associated with it")); + template + static + void + set_vertex_dof_index (dealii::DoFHandler &dof_handler, + const unsigned int vertex_index, + const unsigned int fe_index, + const unsigned int local_index, + const unsigned int global_index) + { + Assert ((fe_index == dealii::DoFHandler::default_fe_index), + ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); + Assert (dof_handler.selected_fe != 0, + ExcMessage ("No finite element collection is associated with " + "this DoFHandler")); + Assert (local_index < dof_handler.selected_fe->dofs_per_vertex, + ExcIndexRange(local_index, 0, + dof_handler.selected_fe->dofs_per_vertex)); + + dof_handler.vertex_dofs[vertex_index * + dof_handler.selected_fe->dofs_per_vertex + + local_index] + = global_index; + } + + + template + static + void + set_vertex_dof_index (dealii::hp::DoFHandler &dof_handler, + const unsigned int vertex_index, + const unsigned int fe_index, + const unsigned int local_index, + const unsigned int global_index) + { + Assert ( (fe_index != dealii::hp::DoFHandler::default_fe_index), + ExcMessage ("You need to specify a FE index when working " + "with hp DoFHandlers")); + Assert (dof_handler.finite_elements != 0, + ExcMessage ("No finite element collection is associated with " + "this DoFHandler")); + Assert (local_index < (*dof_handler.finite_elements)[fe_index].dofs_per_vertex, + ExcIndexRange(local_index, 0, + (*dof_handler.finite_elements)[fe_index].dofs_per_vertex)); + Assert (fe_index < dof_handler.finite_elements->size(), + ExcInternalError()); + Assert (dof_handler.vertex_dofs_offsets[vertex_index] != + numbers::invalid_unsigned_int, + ExcMessage ("This vertex is unused and has no DoFs associated with it")); // hop along the list of index // sets until we find the one @@ -1155,28 +1155,28 @@ namespace internal // part. trigger an exception if // we can't find a set for this // particular fe_index - const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; - unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; - while (true) - { - Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); - - const unsigned int this_fe_index = *pointer; - - Assert (this_fe_index != numbers::invalid_unsigned_int, - ExcInternalError()); - Assert (this_fe_index < dof_handler.finite_elements->size(), - ExcInternalError()); - - if (this_fe_index == fe_index) - { - *(pointer + 1 + local_index) = global_index; - return; - } - else - pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; - } - } + const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; + unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; + while (true) + { + Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); + + const unsigned int this_fe_index = *pointer; + + Assert (this_fe_index != numbers::invalid_unsigned_int, + ExcInternalError()); + Assert (this_fe_index < dof_handler.finite_elements->size(), + ExcInternalError()); + + if (this_fe_index == fe_index) + { + *(pointer + 1 + local_index) = global_index; + return; + } + else + pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; + } + } /** @@ -1190,53 +1190,53 @@ namespace internal * global_index. */ - template - static - unsigned int - get_vertex_dof_index (const dealii::DoFHandler &dof_handler, - const unsigned int vertex_index, - const unsigned int fe_index, - const unsigned int local_index) - { - Assert ((fe_index == dealii::DoFHandler::default_fe_index), - ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); - Assert (dof_handler.selected_fe != 0, - ExcMessage ("No finite element collection is associated with " - "this DoFHandler")); - Assert (local_index < dof_handler.selected_fe->dofs_per_vertex, - ExcIndexRange(local_index, 0, - dof_handler.selected_fe->dofs_per_vertex)); - - return - dof_handler.vertex_dofs[vertex_index * - dof_handler.selected_fe->dofs_per_vertex - + local_index]; - } - - - template - static - unsigned int - get_vertex_dof_index (const dealii::hp::DoFHandler &dof_handler, - const unsigned int vertex_index, - const unsigned int fe_index, - const unsigned int local_index) - { - Assert ( (fe_index != dealii::hp::DoFHandler::default_fe_index), - ExcMessage ("You need to specify a FE index when working " - "with hp DoFHandlers")); - Assert (dof_handler.finite_elements != 0, - ExcMessage ("No finite element collection is associated with " - "this DoFHandler")); - Assert (local_index < (*dof_handler.finite_elements)[fe_index].dofs_per_vertex, - ExcIndexRange(local_index, 0, - (*dof_handler.finite_elements)[fe_index].dofs_per_vertex)); - Assert (vertex_index < dof_handler.vertex_dofs_offsets.size(), - ExcIndexRange (vertex_index, 0, - dof_handler.vertex_dofs_offsets.size())); - Assert (dof_handler.vertex_dofs_offsets[vertex_index] != - numbers::invalid_unsigned_int, - ExcMessage ("This vertex is unused and has no DoFs associated with it")); + template + static + unsigned int + get_vertex_dof_index (const dealii::DoFHandler &dof_handler, + const unsigned int vertex_index, + const unsigned int fe_index, + const unsigned int local_index) + { + Assert ((fe_index == dealii::DoFHandler::default_fe_index), + ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); + Assert (dof_handler.selected_fe != 0, + ExcMessage ("No finite element collection is associated with " + "this DoFHandler")); + Assert (local_index < dof_handler.selected_fe->dofs_per_vertex, + ExcIndexRange(local_index, 0, + dof_handler.selected_fe->dofs_per_vertex)); + + return + dof_handler.vertex_dofs[vertex_index * + dof_handler.selected_fe->dofs_per_vertex + + local_index]; + } + + + template + static + unsigned int + get_vertex_dof_index (const dealii::hp::DoFHandler &dof_handler, + const unsigned int vertex_index, + const unsigned int fe_index, + const unsigned int local_index) + { + Assert ( (fe_index != dealii::hp::DoFHandler::default_fe_index), + ExcMessage ("You need to specify a FE index when working " + "with hp DoFHandlers")); + Assert (dof_handler.finite_elements != 0, + ExcMessage ("No finite element collection is associated with " + "this DoFHandler")); + Assert (local_index < (*dof_handler.finite_elements)[fe_index].dofs_per_vertex, + ExcIndexRange(local_index, 0, + (*dof_handler.finite_elements)[fe_index].dofs_per_vertex)); + Assert (vertex_index < dof_handler.vertex_dofs_offsets.size(), + ExcIndexRange (vertex_index, 0, + dof_handler.vertex_dofs_offsets.size())); + Assert (dof_handler.vertex_dofs_offsets[vertex_index] != + numbers::invalid_unsigned_int, + ExcMessage ("This vertex is unused and has no DoFs associated with it")); // hop along the list of index // sets until we find the one @@ -1245,25 +1245,25 @@ namespace internal // part. trigger an exception if // we can't find a set for this // particular fe_index - const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; - const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; - while (true) - { - Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); + const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; + const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; + while (true) + { + Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); - const unsigned int this_fe_index = *pointer; + const unsigned int this_fe_index = *pointer; - Assert (this_fe_index != numbers::invalid_unsigned_int, - ExcInternalError()); - Assert (this_fe_index < dof_handler.finite_elements->size(), - ExcInternalError()); + Assert (this_fe_index != numbers::invalid_unsigned_int, + ExcInternalError()); + Assert (this_fe_index < dof_handler.finite_elements->size(), + ExcInternalError()); - if (this_fe_index == fe_index) - return *(pointer + 1 + local_index); - else - pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; - } - } + if (this_fe_index == fe_index) + return *(pointer + 1 + local_index); + else + pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; + } + } /** @@ -1272,45 +1272,45 @@ namespace internal * that are active on a given * vertex. */ - template - static - unsigned int - n_active_vertex_fe_indices (const dealii::hp::DoFHandler &dof_handler, - const unsigned int vertex_index) - { - Assert (dof_handler.finite_elements != 0, - ExcMessage ("No finite element collection is associated with " - "this DoFHandler")); + template + static + unsigned int + n_active_vertex_fe_indices (const dealii::hp::DoFHandler &dof_handler, + const unsigned int vertex_index) + { + Assert (dof_handler.finite_elements != 0, + ExcMessage ("No finite element collection is associated with " + "this DoFHandler")); // if this vertex is unused, return 0 - if (dof_handler.vertex_dofs_offsets[vertex_index] == numbers::invalid_unsigned_int) - return 0; + if (dof_handler.vertex_dofs_offsets[vertex_index] == numbers::invalid_unsigned_int) + return 0; // hop along the list of index // sets and count the number of // hops - const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; - const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; + const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; + const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; - Assert (*pointer != numbers::invalid_unsigned_int, - ExcInternalError()); + Assert (*pointer != numbers::invalid_unsigned_int, + ExcInternalError()); - unsigned int counter = 0; - while (true) - { - Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); + unsigned int counter = 0; + while (true) + { + Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); - const unsigned int this_fe_index = *pointer; + const unsigned int this_fe_index = *pointer; - if (this_fe_index == numbers::invalid_unsigned_int) - return counter; - else - { - pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; - ++counter; - } - } - } + if (this_fe_index == numbers::invalid_unsigned_int) + return counter; + else + { + pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; + ++counter; + } + } + } @@ -1319,54 +1319,54 @@ namespace internal * n-th finite element active * on a given vertex. */ - template - static - unsigned int - nth_active_vertex_fe_index (const dealii::hp::DoFHandler &dof_handler, - const unsigned int vertex_index, - const unsigned int n) - { - Assert (dof_handler.finite_elements != 0, - ExcMessage ("No finite element collection is associated with " - "this DoFHandler")); - Assert (n < n_active_vertex_fe_indices(dof_handler, vertex_index), - ExcIndexRange (n, 0, n_active_vertex_fe_indices(dof_handler, - vertex_index))); + template + static + unsigned int + nth_active_vertex_fe_index (const dealii::hp::DoFHandler &dof_handler, + const unsigned int vertex_index, + const unsigned int n) + { + Assert (dof_handler.finite_elements != 0, + ExcMessage ("No finite element collection is associated with " + "this DoFHandler")); + Assert (n < n_active_vertex_fe_indices(dof_handler, vertex_index), + ExcIndexRange (n, 0, n_active_vertex_fe_indices(dof_handler, + vertex_index))); // make sure we don't ask on // unused vertices - Assert (dof_handler.vertex_dofs_offsets[vertex_index] != - numbers::invalid_unsigned_int, - ExcInternalError()); + Assert (dof_handler.vertex_dofs_offsets[vertex_index] != + numbers::invalid_unsigned_int, + ExcInternalError()); // hop along the list of index // sets and count the number of // hops - const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; - const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; + const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; + const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; - Assert (*pointer != numbers::invalid_unsigned_int, - ExcInternalError()); + Assert (*pointer != numbers::invalid_unsigned_int, + ExcInternalError()); - unsigned int counter = 0; - while (true) - { - Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); + unsigned int counter = 0; + while (true) + { + Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); - const unsigned int this_fe_index = *pointer; + const unsigned int this_fe_index = *pointer; - Assert (this_fe_index < dof_handler.finite_elements->size(), - ExcInternalError()); + Assert (this_fe_index < dof_handler.finite_elements->size(), + ExcInternalError()); - if (counter == n) - return this_fe_index; + if (counter == n) + return this_fe_index; - Assert (this_fe_index != numbers::invalid_unsigned_int, - ExcInternalError()); + Assert (this_fe_index != numbers::invalid_unsigned_int, + ExcInternalError()); - pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; - ++counter; - } - } + pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; + ++counter; + } + } @@ -1376,55 +1376,55 @@ namespace internal * active on the specified * vertex. */ - template - static - bool - fe_is_active_on_vertex (const dealii::hp::DoFHandler &dof_handler, - const unsigned int vertex_index, - const unsigned int fe_index) - { - Assert ( (fe_index != dealii::hp::DoFHandler::default_fe_index), - ExcMessage ("You need to specify a FE index when working " - "with hp DoFHandlers")); - Assert (dof_handler.finite_elements != 0, - ExcMessage ("No finite element collection is associated with " - "this DoFHandler")); - Assert (fe_index < dof_handler.finite_elements->size(), - ExcInternalError()); + template + static + bool + fe_is_active_on_vertex (const dealii::hp::DoFHandler &dof_handler, + const unsigned int vertex_index, + const unsigned int fe_index) + { + Assert ( (fe_index != dealii::hp::DoFHandler::default_fe_index), + ExcMessage ("You need to specify a FE index when working " + "with hp DoFHandlers")); + Assert (dof_handler.finite_elements != 0, + ExcMessage ("No finite element collection is associated with " + "this DoFHandler")); + Assert (fe_index < dof_handler.finite_elements->size(), + ExcInternalError()); // make sure we don't ask on // unused vertices - Assert (dof_handler.vertex_dofs_offsets[vertex_index] != - numbers::invalid_unsigned_int, - ExcInternalError()); + Assert (dof_handler.vertex_dofs_offsets[vertex_index] != + numbers::invalid_unsigned_int, + ExcInternalError()); // hop along the list of index // sets and see whether we find // the given index - const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; - const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; + const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; + const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; - Assert (*pointer != numbers::invalid_unsigned_int, - ExcInternalError()); + Assert (*pointer != numbers::invalid_unsigned_int, + ExcInternalError()); - while (true) - { - Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); + while (true) + { + Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); - const unsigned int this_fe_index = *pointer; + const unsigned int this_fe_index = *pointer; - Assert (this_fe_index < dof_handler.finite_elements->size(), - ExcInternalError()); + Assert (this_fe_index < dof_handler.finite_elements->size(), + ExcInternalError()); - if (this_fe_index == numbers::invalid_unsigned_int) - return false; - else - if (this_fe_index == fe_index) - return true; - else - pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; - } - } + if (this_fe_index == numbers::invalid_unsigned_int) + return false; + else + if (this_fe_index == fe_index) + return true; + else + pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; + } + } }; } @@ -1436,34 +1436,40 @@ template inline unsigned int DoFAccessor::dof_index (const unsigned int i, - const unsigned int fe_index) const + const unsigned int fe_index) const { // access the respective DoF return dealii::internal::DoFAccessor::Implementation::get_dof_index (*this->dof_handler, - this->level(), - this->present_index, - fe_index, - i, - dealii::internal::int2type()); + this->level(), + this->present_index, + fe_index, + i, + dealii::internal::int2type()); } +template +inline +unsigned int DoFAccessor::mg_dof_index (const int level, const unsigned int i) const { + return this->dof_handler->template get_dof_index (level, this->present_index, 0, i); +} + template inline void DoFAccessor::set_dof_index (const unsigned int i, - const unsigned int index, - const unsigned int fe_index) const + const unsigned int index, + const unsigned int fe_index) const { // access the respective DoF dealii::internal::DoFAccessor::Implementation::set_dof_index (*this->dof_handler, - this->level(), - this->present_index, - fe_index, - i, - dealii::internal::int2type(), - index); + this->level(), + this->present_index, + fe_index, + i, + dealii::internal::int2type(), + index); } @@ -1477,9 +1483,9 @@ DoFAccessor::n_active_fe_indices () const return dealii::internal::DoFAccessor::Implementation:: n_active_fe_indices (*this->dof_handler, - this->level(), - this->present_index, - dealii::internal::int2type()); + this->level(), + this->present_index, + dealii::internal::int2type()); } @@ -1493,10 +1499,10 @@ DoFAccessor::nth_active_fe_index (const unsigned int n) const return dealii::internal::DoFAccessor::Implementation:: nth_active_fe_index (*this->dof_handler, - this->level(), - this->present_index, - n, - dealii::internal::int2type()); + this->level(), + this->present_index, + n, + dealii::internal::int2type()); } @@ -1510,10 +1516,10 @@ DoFAccessor::fe_index_is_active (const unsigned int fe_index) const return dealii::internal::DoFAccessor::Implementation:: fe_index_is_active (*this->dof_handler, - this->level(), - this->present_index, - fe_index, - dealii::internal::int2type()); + this->level(), + this->present_index, + fe_index, + dealii::internal::int2type()); } @@ -1522,8 +1528,8 @@ template inline unsigned int DoFAccessor::vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index) const + const unsigned int i, + const unsigned int fe_index) const { return dealii::internal::DoFAccessor::Implementation::get_vertex_dof_index @@ -1534,14 +1540,25 @@ DoFAccessor::vertex_dof_index (const unsigned int vertex, } +template +inline +unsigned +DoFAccessor::mg_vertex_dof_index (const int level, const unsigned int vertex, const unsigned int i, const unsigned int fe_index) const { + Assert (this->dof_handler != 0, ExcInvalidObject ()); + Assert (&this->dof_handler->get_fe () != 0, ExcInvalidObject ()); + Assert (vertex < GeometryInfo::vertices_per_cell, ExcIndexRange (vertex, 0, GeometryInfo::vertices_per_cell)); + Assert (i < this->dof_handler->get_fe ()[fe_index].dofs_per_vertex, ExcIndexRange (i, 0, this->dof_handler->get_fe ()[fe_index].dofs_per_vertex)); + return this->dof_handler->mg_vertex_dofs[this->vertex_index (vertex)].get_index (level, i); +} + template inline void DoFAccessor::set_vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int index, - const unsigned int fe_index) const + const unsigned int i, + const unsigned int index, + const unsigned int fe_index) const { dealii::internal::DoFAccessor::Implementation::set_vertex_dof_index (*this->dof_handler, @@ -1552,8 +1569,24 @@ DoFAccessor::set_vertex_dof_index (const unsigned int vertex, } +template +inline +void +DoFAccessor::set_mg_vertex_dof_index (const int level, const unsigned int vertex, const unsigned int i, const unsigned int index, const unsigned int fe_index) const { + Assert (this->dof_handler != 0, ExcInvalidObject ()); + Assert (&this->dof_handler->get_fe () != 0, ExcInvalidObject ()); + Assert (vertex < GeometryInfo::vertices_per_cell, ExcIndexRange (vertex, 0, GeometryInfo::vertices_per_cell)); + Assert (i < this->dof_handler->get_fe ()[fe_index].dofs_per_vertex, ExcIndexRange (i, 0, this->dof_handler->get_fe ()[fe_index].dofs_per_vertex)); + this->dof_handler->mg_vertex_dofs[this->vertex_index (vertex)].set_index (level, i, index); +} +template +inline +void +DoFAccessor::set_mg_dof_index (const int level, const unsigned int i, const unsigned int index) const { + this->dof_handler->template set_dof_index (level, this->present_index, 0, i, index); +} namespace internal @@ -1564,7 +1597,7 @@ namespace internal inline const FiniteElement & get_fe (const FiniteElement &fe, - const unsigned int) + const unsigned int) { return fe; } @@ -1575,7 +1608,7 @@ namespace internal inline const FiniteElement & get_fe (const dealii::hp::FECollection &fe, - const unsigned int index) + const unsigned int index) { return fe[index]; } @@ -1589,7 +1622,7 @@ const FiniteElement & DoFAccessor::get_fe (const unsigned int fe_index) const { Assert (fe_index_is_active (fe_index) == true, - ExcMessage ("This function can only be called for active fe indices")); + ExcMessage ("This function can only be called for active fe indices")); return dealii::internal::DoFAccessor::get_fe (this->dof_handler->get_fe(), fe_index); } @@ -1602,33 +1635,33 @@ namespace internal { template void get_dof_indices (const dealii::DoFAccessor<1,DH> &accessor, - std::vector &dof_indices, - const unsigned int fe_index) + std::vector &dof_indices, + const unsigned int fe_index) { const unsigned int dofs_per_vertex = accessor.get_fe(fe_index).dofs_per_vertex, - dofs_per_line = accessor.get_fe(fe_index).dofs_per_line; + dofs_per_line = accessor.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 void get_dof_indices (const dealii::DoFAccessor<2,DH> &accessor, - std::vector &dof_indices, - const unsigned int fe_index) + std::vector &dof_indices, + const unsigned int fe_index) { const unsigned int dofs_per_vertex = accessor.get_fe(fe_index).dofs_per_vertex, - dofs_per_line = accessor.get_fe(fe_index).dofs_per_line, - dofs_per_quad = accessor.get_fe(fe_index).dofs_per_quad; + dofs_per_line = accessor.get_fe(fe_index).dofs_per_line, + dofs_per_quad = accessor.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; ddof_index(accessor.get_fe(fe_index). - adjust_line_dof_index_for_line_orientation(d, - accessor.line_orientation(line)), - fe_index); + for (unsigned int d=0; ddof_index(accessor.get_fe(fe_index). + adjust_line_dof_index_for_line_orientation(d, + accessor.line_orientation(line)), + fe_index); for (unsigned int d=0; d void get_dof_indices (const dealii::DoFAccessor<3,DH> &accessor, - std::vector &dof_indices, - const unsigned int fe_index) + std::vector &dof_indices, + const unsigned int fe_index) { const unsigned int dofs_per_vertex = accessor.get_fe(fe_index).dofs_per_vertex, - dofs_per_line = accessor.get_fe(fe_index).dofs_per_line, - dofs_per_quad = accessor.get_fe(fe_index).dofs_per_quad, - dofs_per_hex = accessor.get_fe(fe_index).dofs_per_hex; + dofs_per_line = accessor.get_fe(fe_index).dofs_per_line, + dofs_per_quad = accessor.get_fe(fe_index).dofs_per_quad, + dofs_per_hex = accessor.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; ddof_index(accessor.get_fe(fe_index). - adjust_line_dof_index_for_line_orientation(d, - accessor.line_orientation(line)),fe_index); + for (unsigned int d=0; ddof_index(accessor.get_fe(fe_index). + adjust_line_dof_index_for_line_orientation(d, + accessor.line_orientation(line)),fe_index); // now copy dof numbers from the face. for // faces with the wrong orientation, we // have already made sure that we're ok by @@ -1695,15 +1728,72 @@ namespace internal // applies, if the face_rotation or // face_orientation is non-standard for (unsigned int quad=0; quad<6; ++quad) - for (unsigned int d=0; ddof_index(accessor.get_fe(fe_index). - adjust_quad_dof_index_for_face_orientation(d, - accessor.face_orientation(quad), - accessor.face_flip(quad), - accessor.face_rotation(quad)), - fe_index); + for (unsigned int d=0; ddof_index(accessor.get_fe(fe_index). + adjust_quad_dof_index_for_face_orientation(d, + accessor.face_orientation(quad), + accessor.face_flip(quad), + accessor.face_rotation(quad)), + fe_index); for (unsigned int d=0; d + void get_mg_dof_indices (const dealii::DoFAccessor<1, DH>& accessor, const int level, std::vector& dof_indices, const unsigned int fe_index) { + const FiniteElement& fe = accessor.get_dof_handler ().get_fe ()[fe_index]; + std::vector::iterator next = dof_indices.begin (); + + for (unsigned int vertex = 0; vertex < GeometryInfo<1>::vertices_per_cell; ++vertex) + for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof) + *next++ = accessor.mg_vertex_dof_index (level, vertex, dof); + + for (unsigned int dof = 0; dof < fe.dofs_per_line; ++dof) + *next++ = accessor.mg_dof_index (level, dof); + + Assert (next == dof_indices.end (), ExcInternalError ()); + } + + template + void get_mg_dof_indices (const dealii::DoFAccessor<2, DH>& accessor, const int level, std::vector& dof_indices, const unsigned int fe_index) { + const FiniteElement& fe = accessor.get_dof_handler ().get_fe ()[fe_index]; + std::vector::iterator next = dof_indices.begin (); + + for (unsigned int vertex = 0; vertex < GeometryInfo<2>::vertices_per_cell; ++vertex) + for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof) + *next++ = accessor.mg_vertex_dof_index (level, vertex, dof); + + for (unsigned int line = 0; line < GeometryInfo<2>::lines_per_cell; ++line) + for (unsigned int dof = 0; dof < fe.dofs_per_line; ++dof) + *next++ = accessor.line (line)->mg_dof_index (level, dof); + + for (unsigned int dof = 0; dof < fe.dofs_per_quad; ++dof) + *next++ = accessor.mg_dof_index (level, dof); + + Assert (next == dof_indices.end (), ExcInternalError ()); + } + + template + void get_mg_dof_indices (const dealii::DoFAccessor<3, DH>& accessor, const int level, std::vector& dof_indices, const unsigned int fe_index) { + const FiniteElement& fe = accessor.get_dof_handler ().get_fe ()[fe_index]; + std::vector::iterator next = dof_indices.begin (); + + for (unsigned int vertex = 0; vertex < GeometryInfo<3>::vertices_per_cell; ++vertex) + for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof) + *next++ = accessor.mg_vertex_dof_index (level, vertex, dof); + + for (unsigned int line = 0; line < GeometryInfo<3>::lines_per_cell; ++line) + for (unsigned int dof = 0; dof < fe.dofs_per_line; ++dof) + *next++ = accessor.line (line)->mg_dof_index (level, dof); + + for (unsigned int quad = 0; quad < GeometryInfo<3>::quads_per_cell; ++quad) + for (unsigned int dof = 0; dof < fe.dofs_per_quad; ++dof) + *next++ = accessor.quad (quad)->mg_dof_index (level, dof); + + for (unsigned int dof = 0; dof < fe.dofs_per_hex; ++dof) + *next++ = accessor.mg_dof_index (level, dof); + + Assert (next == dof_indices.end (), ExcInternalError ()); } } } @@ -1713,7 +1803,7 @@ template inline void DoFAccessor::get_dof_indices (std::vector &dof_indices, - const unsigned int fe_index) const + const unsigned int fe_index) const { Assert (static_cast(this->level()) < this->dof_handler->levels.size(), ExcMessage ("DoFHandler not initialized")); @@ -1726,28 +1816,28 @@ DoFAccessor::get_dof_indices (std::vector &dof_indic switch (structdim) { case 1: - 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), - ExcVectorDoesNotMatch()); - break; + 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), + ExcVectorDoesNotMatch()); + break; case 2: - 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), - ExcVectorDoesNotMatch()); - break; + 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), + ExcVectorDoesNotMatch()); + break; case 3: - 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), - ExcVectorDoesNotMatch()); - break; + 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), + ExcVectorDoesNotMatch()); + break; default: - Assert (false, ExcNotImplemented()); + Assert (false, ExcNotImplemented()); } @@ -1763,19 +1853,44 @@ DoFAccessor::get_dof_indices (std::vector &dof_indic // not allocated for this // non-active thing Assert (this->fe_index_is_active (fe_index) - || - (this->dof_handler->get_fe()[fe_index].dofs_per_cell == - GeometryInfo::vertices_per_cell * - this->dof_handler->get_fe()[fe_index].dofs_per_vertex), - ExcInternalError()); + || + (this->dof_handler->get_fe()[fe_index].dofs_per_cell == + GeometryInfo::vertices_per_cell * + this->dof_handler->get_fe()[fe_index].dofs_per_vertex), + ExcInternalError()); // now do the actual work dealii::internal::DoFAccessor::get_dof_indices (*this, dof_indices, fe_index); } - - - +template +inline +void DoFAccessor::get_mg_dof_indices (const int level, std::vector& dof_indices, const unsigned int fe_index) const { + Assert (this->dof_handler != 0, ExcInvalidObject ()); + Assert (&this->dof_handler->get_fe () != 0, ExcInvalidObject ()); + + switch (structdim) { + case 1: { + 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, ExcVectorDoesNotMatch ()); + break; + } + + case 2: { + Assert (dof_indices.size () == 4 * (this->dof_handler->get_fe ()[fe_index].dofs_per_vertex + this->dof_handler->get_fe ()[fe_index].dofs_per_line) + this->dof_handler->get_fe ()[fe_index].dofs_per_quad, ExcVectorDoesNotMatch ()); + break; + } + + case 3: { + 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, ExcVectorDoesNotMatch ()); + break; + } + + default: + Assert (false, ExcNotImplemented ()); + } + + internal::DoFAccessor::get_mg_dof_indices (*this, level, dof_indices, fe_index); +} template inline @@ -1831,13 +1946,13 @@ template