From: Wolfgang Bangerth Date: Tue, 12 Sep 2017 22:47:30 +0000 (-0600) Subject: Fix a bug in hp DoF unification. X-Git-Tag: v9.0.0-rc1~1085^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F5068%2Fhead;p=dealii.git Fix a bug in hp DoF unification. Specifically, in the first phase of DoF distribution, we only enumerate DoF indices on locally owned cells. Thus, after unification when we renumber, we need to ignore DoFs on ghost cells. In that case, we need to pass the correct 'check_validity' flag to the renumbering routines. --- diff --git a/source/dofs/dof_handler_policy.cc b/source/dofs/dof_handler_policy.cc index ff966fe300..d59731c8f5 100644 --- a/source/dofs/dof_handler_policy.cc +++ b/source/dofs/dof_handler_policy.cc @@ -1022,7 +1022,8 @@ namespace internal static unsigned int unify_dof_indices (const DoFHandler &, - const unsigned int n_dofs_before_identification) + const unsigned int n_dofs_before_identification, + const bool) { return n_dofs_before_identification; } @@ -1033,7 +1034,8 @@ namespace internal static unsigned int unify_dof_indices (hp::DoFHandler &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 @@ -1103,12 +1105,13 @@ namespace internal 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; @@ -1149,7 +1152,13 @@ namespace internal 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); @@ -1569,6 +1578,16 @@ namespace internal = 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