static
unsigned int
unify_dof_indices (const DoFHandler<dim,spacedim> &,
- const unsigned int n_dofs_before_identification)
+ const unsigned int n_dofs_before_identification,
+ const bool)
{
return n_dofs_before_identification;
}
static
unsigned int
unify_dof_indices (hp::DoFHandler<dim,spacedim> &dof_handler,
- const unsigned int n_dofs_before_identification)
+ const unsigned int n_dofs_before_identification,
+ const bool check_validity)
{
// compute the constraints that correspond to unifying
// dof indices on vertices, lines, and quads. do so
ExcInternalError());
}
- // finally, do the renumbering and set the number of actually
- // used dof indices
+ // finally, do the renumbering. verify that previous dof indices
+ // were indeed all valid on all cells that we touch if we were
+ // told to do so
renumber_dofs (new_dof_indices,
IndexSet(0),
dof_handler,
- true);
+ check_validity);
return next_free_dof;
next_free_dof);
// Step 2: unify dof indices in case this is an hp DoFHandler
- next_free_dof = unify_dof_indices (dof_handler, next_free_dof);
+ //
+ // during unification, we need to renumber DoF indices. there,
+ // we can check that all previous DoF indices were valid, but
+ // this only makes sense if we really distributed DoFs on
+ // all (non-artificial) cells above
+ next_free_dof = unify_dof_indices (dof_handler, next_free_dof,
+ /* check_validity = */ (subdomain_id == numbers::invalid_subdomain_id));
update_all_active_cell_dof_indices_caches (dof_handler);
= dealii::internal::DoFAccessor::Implementation::
n_active_vertex_fe_indices (dof_handler, vertex_index);
+ // if this vertex is unused, then we really ought not to have allocated
+ // any space for it, i.e., n_active_fe_indices should be zero, and
+ // there is no space to actually store dof indices for this vertex
+ if (dof_handler.get_triangulation().vertex_used(vertex_index) == false)
+ Assert (n_active_fe_indices == 0,
+ ExcInternalError());
+
+ // otherwise the vertex is used; it may still not hold any dof indices
+ // if it is located on an artificial cell and not adjacent to a ghost
+ // cell, but in that case there is simply nothing for us to do
for (unsigned int f=0; f<n_active_fe_indices; ++f)
{
const unsigned int fe_index
vertex_index,
fe_index,
d);
+
+ // if check_validity was set, then we are to verify that the
+ // previous indices were all valid. this really should be
+ // the case: we allocated space for these vertex dofs,
+ // i.e., at least one adjacent cell has a valid
+ // active_fe_index, so there are DoFs that really live
+ // on this vertex. if check_validity is set, then we
+ // must make sure that they have been set to something
+ // useful
+ if (check_validity)
+ Assert (old_dof_index != numbers::invalid_dof_index,
+ ExcInternalError());
+
if (old_dof_index != numbers::invalid_dof_index)
dealii::internal::DoFAccessor::Implementation::
set_vertex_dof_index (dof_handler,
(indices.size() == 0)?
(new_numbers[old_dof_index]) :
(new_numbers[indices.index_within_set(old_dof_index)]));
- else if (check_validity)
- // if index is invalid_dof_index: check if this one
- // really is unused
- Assert (dof_handler.get_triangulation()
- .vertex_used(vertex_index)
- == false,
- ExcInternalError ());
}
}
}