* The vector has to have the
* right size before being passed
* to this function.
+ *
+ * This function is most often
+ * used on active objects (edges,
+ * faces, cells). It can be used
+ * on non-active objects as well
+ * (i.e. objects that have
+ * children), but only if the
+ * finite element under
+ * consideration has degrees of
+ * freedom exclusively on
+ * vertices. Otherwise, the
+ * function doesn't make much
+ * sense, since for example
+ * inactive edges do not have
+ * degrees of freedom associated
+ * with them at all.
*/
void get_dof_indices (std::vector<unsigned int> &dof_indices) const;
*
* It is assumed that the vector already
* has the right size beforehand.
+ *
+ * This function is most often
+ * used on active objects (edges,
+ * faces, cells). It can be used
+ * on non-active objects as well
+ * (i.e. objects that have
+ * children), but only if the
+ * finite element under
+ * consideration has degrees of
+ * freedom exclusively on
+ * vertices. Otherwise, the
+ * function doesn't make much
+ * sense, since for example
+ * inactive edges do not have
+ * degrees of freedom associated
+ * with them at all.
*/
void get_dof_indices (std::vector<unsigned int> &dof_indices) const;
*
* It is assumed that the vector already
* has the right size beforehand.
+ *
+ * This function is most often
+ * used on active objects (edges,
+ * faces, cells). It can be used
+ * on non-active objects as well
+ * (i.e. objects that have
+ * children), but only if the
+ * finite element under
+ * consideration has degrees of
+ * freedom exclusively on
+ * vertices. Otherwise, the
+ * function doesn't make much
+ * sense, since for example
+ * inactive edges do not have
+ * degrees of freedom associated
+ * with them at all.
*/
void get_dof_indices (std::vector<unsigned int> &dof_indices) const;
*
* It is assumed that the vector already
* has the right size beforehand.
+ *
+ * This function is most often
+ * used on active objects (edges,
+ * faces, cells). It can be used
+ * on non-active objects as well
+ * (i.e. objects that have
+ * children), but only if the
+ * finite element under
+ * consideration has degrees of
+ * freedom exclusively on
+ * vertices. Otherwise, the
+ * function doesn't make much
+ * sense, since for example
+ * inactive edges do not have
+ * degrees of freedom associated
+ * with them at all.
*/
void get_dof_indices (std::vector<unsigned int> &dof_indices) const;
template <class OutputVector, typename number>
void set_dof_values_by_interpolation (const Vector<number> &local_values,
OutputVector &values) const;
+
+ /**
+ * Return the indices of the dofs of this
+ * quad 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 reimplements the
+ * same function in the base
+ * class. The functions in the
+ * base classes are available for
+ * all geometric objects,
+ * i.e. even in 3d they can be
+ * used to access the dof indices
+ * of edges, for example. On the
+ * other hand, the most common
+ * case is clearly the use on
+ * cells, which is why we cache
+ * the array for each cell, but
+ * not edge. To retrieve the
+ * cached values, rather than
+ * collect the necessary
+ * information every time, this
+ * function overwrites the one in
+ * the base class.
+ *
+ * This function is most often
+ * used on active objects (edges,
+ * faces, cells). It can be used
+ * on non-active objects as well
+ * (i.e. objects that have
+ * children), but only if the
+ * finite element under
+ * consideration has degrees of
+ * freedom exclusively on
+ * vertices. Otherwise, the
+ * function doesn't make much
+ * sense, since for example
+ * inactive edges do not have
+ * degrees of freedom associated
+ * with them at all.
+ */
+ void get_dof_indices (std::vector<unsigned int> &dof_indices) const;
+ private:
+ /**
+ * Update the cache in which we
+ * store the dof indices of this
+ * cell.
+ */
+ void update_cell_dof_indices_cache () const;
+
+ /**
+ * Make the DoFHandler class a
+ * friend so that it can call the
+ * update_cell_dof_indices_cache()
+ * function
+ */
+ template <int> friend class DoFHandler;
};
DoFObjectAccessor<3,hp::DoFHandler<3> >::set_active_fe_index (const unsigned int i);
+template <>
+void
+DoFCellAccessor<DoFHandler<1> >::update_cell_dof_indices_cache () const;
+template <>
+void
+DoFCellAccessor<DoFHandler<2> >::update_cell_dof_indices_cache () const;
+template <>
+void
+DoFCellAccessor<DoFHandler<3> >::update_cell_dof_indices_cache () const;
+
+template <>
+void
+DoFCellAccessor<hp::DoFHandler<1> >::update_cell_dof_indices_cache () const;
+template <>
+void
+DoFCellAccessor<hp::DoFHandler<2> >::update_cell_dof_indices_cache () const;
+template <>
+void
+DoFCellAccessor<hp::DoFHandler<3> >::update_cell_dof_indices_cache () const;
+
+
+
// include more templates
#include "dof_accessor.templates.h"
DoFObjectAccessor<1,DH>::dof_index (const unsigned int i) const
{
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
// since the exception classes are
// from a template dependent base
const unsigned int i) const
{
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
// since the exception classes are
// from a template dependent base
DoFObjectAccessor<1,DH>::get_dof_indices (std::vector<unsigned int> &dof_indices) const
{
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
// since the exception classes are
// from a template dependent base
DoFObjectAccessor<1,DH>::child (const unsigned int i) const
{
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
TriaIterator<dim,DoFObjectAccessor<1,DH> > q (this->tria,
this->present_level+1,
Assert (i<this->get_fe().dofs_per_quad,
ExcIndexRange (i, 0, this->get_fe().dofs_per_quad));
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
return this->dof_handler->levels[this->present_level]
->quad_dofs[this->present_index*this->get_fe().dofs_per_quad+i];
Assert (i<this->get_fe().dofs_per_vertex,
ExcIndexRange (i, 0, this->get_fe().dofs_per_vertex));
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
const unsigned int dof_number = (this->vertex_index(vertex) *
this->get_fe().dofs_per_vertex +
}
-
template <class DH>
inline
void
typename BaseClass::ExcNotActive());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
const unsigned int dofs_per_vertex = this->get_fe().dofs_per_vertex,
dofs_per_line = this->get_fe().dofs_per_line,
{
Assert (i<4, ExcIndexRange (i, 0, 4));
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
return TriaIterator<dim,DoFObjectAccessor<1,DH> >
(
DoFObjectAccessor<2,DH>::child (const unsigned int i) const
{
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
TriaIterator<dim,DoFObjectAccessor<2,DH> > q (this->tria,
this->present_level+1,
typename BaseClass::ExcVectorDoesNotMatch());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
const unsigned int n_dofs = local_source.size();
Assert (global_destination.m() == global_destination.n(),
typename BaseClass::ExcMatrixDoesNotMatch());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
const unsigned int n_dofs = local_source.m();
Assert (i<this->get_fe().dofs_per_hex,
ExcIndexRange (i, 0, this->get_fe().dofs_per_hex));
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
return this->dof_handler->levels[this->present_level]
->hex_dofs[this->present_index*this->get_fe().dofs_per_hex+i];
Assert (i<this->get_fe().dofs_per_vertex,
ExcIndexRange (i, 0, this->get_fe().dofs_per_vertex));
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
const unsigned int dof_number = (this->vertex_index(vertex) *
this->get_fe().dofs_per_vertex +
this->get_fe().dofs_per_hex),
typename BaseClass::ExcVectorDoesNotMatch());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
// this function really only makes
// sense on non-active objects if
8*this->get_fe().dofs_per_vertex),
typename BaseClass::ExcNotActive());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
const unsigned int dofs_per_vertex = this->get_fe().dofs_per_vertex,
dofs_per_line = this->get_fe().dofs_per_line,
Assert (this->dof_handler->n_dofs() == global_destination.size(),
typename BaseClass::ExcVectorDoesNotMatch());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
const unsigned int n_dofs = local_source.size();
Assert (global_destination.m() == global_destination.n(),
typename BaseClass::ExcMatrixDoesNotMatch());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
const unsigned int n_dofs = local_source.m();
Assert (this->dof_handler != 0, BaseClass::ExcInvalidObject());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
// make sure a FE has been selected
// and enough room was reserved
Assert (&this->get_fe() != 0, BaseClass::ExcInvalidObject());
Assert (this->dof_handler != 0, BaseClass::ExcInvalidObject());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
// make sure a FE has been selected
// and enough room was reserved
Assert (&this->get_fe() != 0, BaseClass::ExcInvalidObject());
Assert (this->dof_handler != 0, BaseClass::ExcInvalidObject());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
// make sure a FE has been selected
// and enough room was reserved
Assert (&this->get_fe() != 0, BaseClass::ExcInvalidObject());
Assert (this->dof_handler != 0,
BaseClass::ExcInvalidObject());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
// make sure a FE has been selected
// and enough room was reserved
Assert (&this->get_fe() != 0,
Assert (this->dof_handler != 0,
BaseClass::ExcInvalidObject());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
// make sure a FE has been selected
// and enough room was reserved
Assert (&this->get_fe() != 0,
Assert (this->dof_handler != 0,
BaseClass::ExcInvalidObject());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
// make sure a FE has been selected
// and enough room was reserved
Assert (&this->get_fe() != 0,
DoFObjectAccessor<1,hp::DoFHandler<1> >::active_fe_index () const
{
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
this->dof_handler->levels[this->present_level]->active_fe_indices.size (),
ExcIndexRange (this->present_index, 0,
DoFObjectAccessor<1,hp::DoFHandler<2> >::active_fe_index () const
{
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
this->dof_handler->levels[this->present_level]->active_fe_indices.size (),
ExcIndexRange (this->present_index, 0,
DoFObjectAccessor<1,hp::DoFHandler<3> >::active_fe_index () const
{
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
this->dof_handler->levels[this->present_level]->active_fe_indices.size (),
ExcIndexRange (this->present_index, 0,
Assert (this->dof_handler != 0, ExcInvalidObject());
Assert (static_cast<unsigned int>(this->present_level) <
this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
this->dof_handler->levels[this->present_level]->active_fe_indices.size (),
ExcIndexRange (this->present_index, 0,
{
Assert (this->dof_handler != 0, ExcInvalidObject());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
this->dof_handler->levels[this->present_level]->active_fe_indices.size (),
ExcIndexRange (this->present_index, 0,
{
Assert (this->dof_handler != 0, ExcInvalidObject());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
this->dof_handler->levels[this->present_level]->active_fe_indices.size (),
ExcIndexRange (this->present_index, 0,
Assert (this->dof_handler != 0,
BaseClass::ExcInvalidObject());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
// make sure a FE has been selected
// and enough room was reserved
Assert (&this->get_fe() != 0,
Assert (this->dof_handler != 0,
BaseClass::ExcInvalidObject());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
// make sure a FE has been selected
// and enough room was reserved
Assert (&this->get_fe() != 0,
Assert (this->dof_handler != 0,
BaseClass::ExcInvalidObject());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
// make sure a FE has been selected
// and enough room was reserved
Assert (&this->get_fe() != 0,
Assert (this->dof_handler != 0,
BaseClass::ExcInvalidObject());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
// make sure a FE has been selected
// and enough room was reserved
Assert (&this->get_fe() != 0,
DoFObjectAccessor<2,hp::DoFHandler<2> >::active_fe_index () const
{
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
this->dof_handler->levels[this->present_level]->active_fe_indices.size (),
ExcIndexRange (this->present_index, 0,
DoFObjectAccessor<2,hp::DoFHandler<3> >::active_fe_index () const
{
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
this->dof_handler->levels[this->present_level]->active_fe_indices.size (),
ExcIndexRange (this->present_index, 0,
{
Assert (this->dof_handler != 0, ExcInvalidObject());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
this->dof_handler->levels[this->present_level]->active_fe_indices.size (),
ExcIndexRange (this->present_index, 0,
{
Assert (this->dof_handler != 0, ExcInvalidObject());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
this->dof_handler->levels[this->present_level]->active_fe_indices.size (),
ExcIndexRange (this->present_index, 0,
Assert (this->dof_handler != 0,
BaseClass::ExcInvalidObject());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
// make sure a FE has been selected
// and enough room was reserved
Assert (&this->get_fe() != 0,
Assert (this->dof_handler != 0,
BaseClass::ExcInvalidObject());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
// make sure a FE has been selected
// and enough room was reserved
Assert (&this->get_fe() != 0,
DoFObjectAccessor<3,hp::DoFHandler<3> >::active_fe_index () const
{
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
this->dof_handler->levels[this->present_level]->active_fe_indices.size (),
ExcIndexRange (this->present_index, 0,
{
Assert (this->dof_handler != 0, ExcInvalidObject());
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("hp::DoFHandler not initialized"));
+ ExcMessage ("DoFHandler not initialized"));
Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
this->dof_handler->levels[this->present_level]->active_fe_indices.size (),
ExcIndexRange (this->present_index, 0,
}
+
+
+template <>
+inline
+void
+DoFCellAccessor<DoFHandler<1> >::
+get_dof_indices (std::vector<unsigned int> &dof_indices) const
+{
+ Assert (dof_indices.size() == this->get_fe().dofs_per_cell,
+ ExcVectorDoesNotMatch());
+
+ // check as in documentation that
+ // cell is either active, or dofs
+ // are only in vertices
+ Assert (!this->has_children()
+ ||
+ (this->get_fe().dofs_per_cell ==
+ this->get_fe().dofs_per_vertex * GeometryInfo<1>::vertices_per_cell),
+ ExcMessage ("Cell must either be active, or all DoFs must be in vertices"));
+
+ unsigned int *cache = &this->dof_handler->levels[this->present_level]
+ ->cell_dof_indices_cache[this->present_index * this->get_fe().dofs_per_cell];
+ for (unsigned int i=0; i<this->get_fe().dofs_per_cell; ++i, ++cache)
+ dof_indices[i] = *cache;
+}
+
+
+
+template <>
+inline
+void
+DoFCellAccessor<hp::DoFHandler<1> >::
+get_dof_indices (std::vector<unsigned int> &dof_indices) const
+{
+ // no caching for hp::DoFHandler implemented
+ DoFObjectAccessor<dim,hp::DoFHandler<dim> >::get_dof_indices (dof_indices);
+}
+
+
+
+template <>
+inline
+void
+DoFCellAccessor<DoFHandler<2> >::
+get_dof_indices (std::vector<unsigned int> &dof_indices) const
+{
+ Assert (dof_indices.size() == this->get_fe().dofs_per_cell,
+ ExcVectorDoesNotMatch());
+
+ // check as in documentation that
+ // cell is either active, or dofs
+ // are only in vertices
+ Assert (!this->has_children()
+ ||
+ (this->get_fe().dofs_per_cell ==
+ this->get_fe().dofs_per_vertex * GeometryInfo<2>::vertices_per_cell),
+ ExcMessage ("Cell must either be active, or all DoFs must be in vertices"));
+
+ unsigned int *cache = &this->dof_handler->levels[this->present_level]
+ ->cell_dof_indices_cache[this->present_index * this->get_fe().dofs_per_cell];
+ for (unsigned int i=0; i<this->get_fe().dofs_per_cell; ++i, ++cache)
+ dof_indices[i] = *cache;
+}
+
+
+
+template <>
+inline
+void
+DoFCellAccessor<hp::DoFHandler<2> >::
+get_dof_indices (std::vector<unsigned int> &dof_indices) const
+{
+ // no caching for hp::DoFHandler implemented
+ DoFObjectAccessor<dim,hp::DoFHandler<dim> >::get_dof_indices (dof_indices);
+}
+
+
+
+template <>
+inline
+void
+DoFCellAccessor<DoFHandler<3> >::
+get_dof_indices (std::vector<unsigned int> &dof_indices) const
+{
+ Assert (dof_indices.size() == this->get_fe().dofs_per_cell,
+ ExcVectorDoesNotMatch());
+
+ // check as in documentation that
+ // cell is either active, or dofs
+ // are only in vertices
+ Assert (!this->has_children()
+ ||
+ (this->get_fe().dofs_per_cell ==
+ this->get_fe().dofs_per_vertex * GeometryInfo<3>::vertices_per_cell),
+ ExcMessage ("Cell must either be active, or all DoFs must be in vertices"));
+
+ unsigned int *cache = &this->dof_handler->levels[this->present_level]
+ ->cell_dof_indices_cache[this->present_index * this->get_fe().dofs_per_cell];
+ for (unsigned int i=0; i<this->get_fe().dofs_per_cell; ++i, ++cache)
+ dof_indices[i] = *cache;
+}
+
+
+
+template <>
+inline
+void
+DoFCellAccessor<hp::DoFHandler<3> >::
+get_dof_indices (std::vector<unsigned int> &dof_indices) const
+{
+ // no caching for hp::DoFHandler implemented
+ DoFObjectAccessor<dim,hp::DoFHandler<dim> >::get_dof_indices (dof_indices);
+}
+
+
#endif
return TriaIterator<1, DoFObjectAccessor<0,DoFHandler<1> > >();
}
+
+template <>
+void
+DoFCellAccessor<DoFHandler<1> >::update_cell_dof_indices_cache () const
+{
+ Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
+ ExcMessage ("DoFHandler not initialized"));
+
+ Assert (this->dof_handler != 0, DoFAccessor<DoFHandler<1> >::ExcInvalidObject());
+ Assert (&this->get_fe() != 0, DoFAccessor<DoFHandler<1> >::ExcInvalidObject());
+
+ // check as in documentation that
+ // cell is either active, or dofs
+ // are only in vertices. otherwise
+ // simply don't update the cache at
+ // all. the get_dof_indices
+ // function will then make sure we
+ // don't access the invalid data
+ if (this->has_children()
+ &&
+ (this->get_fe().dofs_per_cell !=
+ this->get_fe().dofs_per_vertex * GeometryInfo<1>::vertices_per_cell))
+ return;
+
+ const unsigned int dofs_per_vertex = this->get_fe().dofs_per_vertex,
+ dofs_per_line = this->get_fe().dofs_per_line,
+ dofs_per_cell = this->get_fe().dofs_per_cell;
+
+ // make sure the cache is at least
+ // as big as we need it when
+ // writing to the last element of
+ // this cell
+ Assert (this->present_index * dofs_per_cell + dofs_per_cell
+ <=
+ this->dof_handler->levels[this->present_level]
+ ->cell_dof_indices_cache.size(),
+ ExcInternalError());
+
+ std::vector<unsigned int>::iterator next
+ = (this->dof_handler->levels[this->present_level]
+ ->cell_dof_indices_cache.begin() + this->present_index * dofs_per_cell);
+
+ for (unsigned int vertex=0; vertex<2; ++vertex)
+ for (unsigned int d=0; d<dofs_per_vertex; ++d)
+ *next++ = vertex_dof_index(vertex,d);
+ for (unsigned int d=0; d<dofs_per_line; ++d)
+ *next++ = dof_index(d);
+}
+
+
+
+template <>
+void
+DoFCellAccessor<hp::DoFHandler<1> >::update_cell_dof_indices_cache () const
+{
+ // not implemented, but should also
+ // not be called
+ Assert (false, ExcNotImplemented());
+}
+
+
+
#endif
return this->line(i);
}
+
+
+template <>
+void
+DoFCellAccessor<DoFHandler<2> >::update_cell_dof_indices_cache () const
+{
+ Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
+ ExcMessage ("DoFHandler not initialized"));
+
+ Assert (this->dof_handler != 0, DoFAccessor<DoFHandler<2> >::ExcInvalidObject());
+ Assert (&this->get_fe() != 0, DoFAccessor<DoFHandler<2> >::ExcInvalidObject());
+
+ // check as in documentation that
+ // cell is either active, or dofs
+ // are only in vertices. otherwise
+ // simply don't update the cache at
+ // all. the get_dof_indices
+ // function will then make sure we
+ // don't access the invalid data
+ if (this->has_children()
+ &&
+ (this->get_fe().dofs_per_cell !=
+ this->get_fe().dofs_per_vertex * GeometryInfo<2>::vertices_per_cell))
+ return;
+
+ const unsigned int dofs_per_vertex = this->get_fe().dofs_per_vertex,
+ dofs_per_line = this->get_fe().dofs_per_line,
+ dofs_per_quad = this->get_fe().dofs_per_quad,
+ dofs_per_cell = this->get_fe().dofs_per_cell;
+
+ // make sure the cache is at least
+ // as big as we need it when
+ // writing to the last element of
+ // this cell
+ Assert (this->present_index * dofs_per_cell + dofs_per_cell
+ <=
+ this->dof_handler->levels[this->present_level]
+ ->cell_dof_indices_cache.size(),
+ ExcInternalError());
+
+ std::vector<unsigned int>::iterator next
+ = (this->dof_handler->levels[this->present_level]
+ ->cell_dof_indices_cache.begin() + this->present_index * dofs_per_cell);
+
+ for (unsigned int vertex=0; vertex<4; ++vertex)
+ for (unsigned int d=0; d<dofs_per_vertex; ++d)
+ *next++ = vertex_dof_index(vertex,d);
+ for (unsigned int line=0; line<4; ++line)
+ for (unsigned int d=0; d<dofs_per_line; ++d)
+ *next++ = this->line(line)->dof_index(d);
+ for (unsigned int d=0; d<dofs_per_quad; ++d)
+ *next++ = dof_index(d);
+}
+
+
+
+template <>
+void
+DoFCellAccessor<hp::DoFHandler<2> >::update_cell_dof_indices_cache () const
+{
+ // not implemented, but should also
+ // not be called
+ Assert (false, ExcNotImplemented());
+}
+
+
#endif
return this->quad(i);
}
+
+
+template <>
+void
+DoFCellAccessor<DoFHandler<3> >::update_cell_dof_indices_cache () const
+{
+ Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
+ ExcMessage ("DoFHandler not initialized"));
+
+ Assert (this->dof_handler != 0, DoFAccessor<DoFHandler<3> >::ExcInvalidObject());
+ Assert (&this->get_fe() != 0, DoFAccessor<DoFHandler<3> >::ExcInvalidObject());
+
+ // check as in documentation that
+ // cell is either active, or dofs
+ // are only in vertices. otherwise
+ // simply don't update the cache at
+ // all. the get_dof_indices
+ // function will then make sure we
+ // don't access the invalid data
+ if (this->has_children()
+ &&
+ (this->get_fe().dofs_per_cell !=
+ this->get_fe().dofs_per_vertex * GeometryInfo<3>::vertices_per_cell))
+ return;
+
+ const unsigned int dofs_per_vertex = this->get_fe().dofs_per_vertex,
+ dofs_per_line = this->get_fe().dofs_per_line,
+ dofs_per_quad = this->get_fe().dofs_per_quad,
+ dofs_per_hex = this->get_fe().dofs_per_hex,
+ dofs_per_cell = this->get_fe().dofs_per_cell;
+
+ // make sure the cache is at least
+ // as big as we need it when
+ // writing to the last element of
+ // this cell
+ Assert (this->present_index * dofs_per_cell + dofs_per_cell
+ <=
+ this->dof_handler->levels[this->present_level]
+ ->cell_dof_indices_cache.size(),
+ ExcInternalError());
+
+ std::vector<unsigned int>::iterator next
+ = (this->dof_handler->levels[this->present_level]
+ ->cell_dof_indices_cache.begin() + this->present_index * dofs_per_cell);
+
+ for (unsigned int vertex=0; vertex<8; ++vertex)
+ for (unsigned int d=0; d<dofs_per_vertex; ++d)
+ *next++ = vertex_dof_index(vertex,d);
+ for (unsigned int line=0; line<12; ++line)
+ for (unsigned int d=0; d<dofs_per_line; ++d)
+ *next++ = this->line(line)->dof_index(d);
+ for (unsigned int quad=0; quad<6; ++quad)
+ for (unsigned int d=0; d<dofs_per_quad; ++d)
+ *next++ = this->quad(quad)->dof_index(d);
+ for (unsigned int d=0; d<dofs_per_hex; ++d)
+ *next++ = dof_index(d);
+}
+
+
+template <>
+void
+DoFCellAccessor<hp::DoFHandler<3> >::update_cell_dof_indices_cache () const
+{
+ // not implemented, but should also
+ // not be called
+ Assert (false, ExcNotImplemented());
+}
+
+
#endif