const unsigned int vertex_index,
const unsigned int i)
{
- return dof_handler.mg_vertex_dofs[vertex_index].get_index (level, i);
+ return dof_handler.mg_vertex_dofs[vertex_index].get_index (level, i,
+ dof_handler.get_fe().dofs_per_vertex);
}
const unsigned int i,
types::global_dof_index index)
{
- return dof_handler.mg_vertex_dofs[vertex_index].set_index (level, i, index);
+ return dof_handler.mg_vertex_dofs[vertex_index].set_index (level, i,
+ dof_handler.get_fe().dofs_per_vertex,
+ index);
}
*/
types::global_dof_index
get_index (const unsigned int level,
- const unsigned int dof_number) const;
+ const unsigned int dof_number,
+ const unsigned int dofs_per_vertex) const;
/**
* Set the index of the <code>dof_number</code>th degree of freedom for
* the given level stored for the current vertex to <code>index</code>.
*/
- void set_index (const unsigned int level,
- const unsigned int dof_number,
+ void set_index (const unsigned int level,
+ const unsigned int dof_number,
+ const unsigned int dofs_per_vertex,
const types::global_dof_index index);
private:
*/
unsigned int finest_level;
- /**
- * The number of degrees of freedom per vertex. We need to store
- * this because every object of this kind stores the indices on
- * all relevant levels in one array, and the starting offset for
- * a particular level is determined by that level's index times
- * the number of degrees of freedom per vertex.
- */
- unsigned int dofs_per_vertex;
-
/**
* A pointer to an array where we store the indices of the DoFs that live
* on the various levels this vertex exists on.
*
* The starting offset of the DoFs that belong to a @p level are given by
- * <code>dofs_per_vertex * (level-coarsest_level)</code>.
+ * <code>dofs_per_vertex * (level-coarsest_level)</code>. @p dofs_per_vertex
+ * must therefore be passed as an argument to the functions that set or
+ * read an index.
*/
std::unique_ptr<types::global_dof_index[]> indices;
};
inline
types::global_dof_index
DoFHandler<dim, spacedim>::MGVertexDoFs::get_index (const unsigned int level,
- const unsigned int dof_number) const
+ const unsigned int dof_number,
+ const unsigned int dofs_per_vertex) const
{
Assert ((level >= coarsest_level) && (level <= finest_level), ExcInvalidLevel (level));
return indices[dofs_per_vertex * (level - coarsest_level) + dof_number];
template <int dim, int spacedim>
inline
void
-DoFHandler<dim, spacedim>::MGVertexDoFs::set_index (const unsigned int level,
- const unsigned int dof_number,
+DoFHandler<dim, spacedim>::MGVertexDoFs::set_index (const unsigned int level,
+ const unsigned int dof_number,
+ const unsigned int dofs_per_vertex,
const types::global_dof_index index)
{
Assert ((level >= coarsest_level) && (level <= finest_level), ExcInvalidLevel (level));
(i->get_finest_level() >= level))
for (unsigned int d=0; d<dof_handler.get_fe().dofs_per_vertex; ++d)
{
- const dealii::types::global_dof_index idx = i->get_index (level, d);
+ const dealii::types::global_dof_index idx
+ = i->get_index (level, d, dof_handler.get_fe().dofs_per_vertex);
+
if (check_validity)
Assert(idx != numbers::invalid_dof_index, ExcInternalError ());
if (idx != numbers::invalid_dof_index)
i->set_index (level, d,
+ dof_handler.get_fe().dofs_per_vertex,
(indices.size() == 0)?
(new_numbers[idx]) :
(new_numbers[indices.index_within_set(idx)]));