* ::DoFHandler class, this value must be equal to its default value since
* that class only supports the same finite element on all cells anyway.
*
- * However, when hp-capabilities are enabled, different finite element
- * objects may be used on different cells. On faces between two cells, as
- * well as vertices, there may therefore be two sets of degrees of freedom,
- * one for each of the finite elements used on the adjacent cells. In order
- * to specify which set of degrees of freedom to work on, the last argument
- * is used to disambiguate. Finally, if this function is called for a cell
+ * However, when hp-capabilities are enabled, different finite
+ * element objects may be used on different cells. On faces between
+ * two cells, as well as vertices, there may therefore be two sets
+ * of degrees of freedom, one for each of the finite elements used
+ * on the adjacent cells. In order to specify which set of degrees
+ * of freedom to work on, the last argument is used to
+ * disambiguate. Finally, if this function is called for a cell
* object, there can only be a single set of degrees of freedom, and
- * fe_index has to match the result of active_fe_index().
+ * `fe_index` has to match the result of
+ * `cell->active_fe_index()`. Alternatively, if `fe_index` is left
+ * to its default value when this function is called on a cell, then
+ * this is interpreted as equal to `cell->active_fe_index()`.
*/
types::global_dof_index
vertex_dof_index(const unsigned int vertex,
const unsigned int fe_index_) const
{
const unsigned int fe_index =
- (this->dof_handler->hp_capability_enabled == false &&
- fe_index_ == DoFHandler<dim, spacedim>::invalid_fe_index) ?
- DoFHandler<dim, spacedim>::default_fe_index :
- fe_index_;
+ (((this->dof_handler->hp_capability_enabled == false) &&
+ (fe_index_ == DoFHandler<dim, spacedim>::invalid_fe_index)) ?
+ // No hp enabled, and the argument is at its default value -> we
+ // can translate to the default active fe index
+ DoFHandler<dim, spacedim>::default_fe_index :
+ // Otherwise: If anything other than the default is provided by
+ // the caller, then we should take just that. As an exception, if
+ // we are on a cell (rather than a face/edge/vertex), then we know
+ // that there is only one active fe index on this cell and we can
+ // use that:
+ ((dim == structdim) &&
+ (fe_index_ == DoFHandler<dim, spacedim>::invalid_fe_index) ?
+ this->nth_active_fe_index(0) :
+ fe_index_));
return dealii::internal::DoFAccessorImplementation::Implementation::
get_dof_index(*this->dof_handler,