From 6a2d499743e2e920950ea6f0bcf377d72cd210ba Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 12 Sep 2018 11:54:30 -0600 Subject: [PATCH] Add an assertion. --- source/dofs/dof_handler_policy.cc | 78 +++++++++++++++++++++---------- 1 file changed, 54 insertions(+), 24 deletions(-) diff --git a/source/dofs/dof_handler_policy.cc b/source/dofs/dof_handler_policy.cc index 8b255be4d1..b82f001644 100644 --- a/source/dofs/dof_handler_policy.cc +++ b/source/dofs/dof_handler_policy.cc @@ -2599,16 +2599,29 @@ namespace internal ExcInternalError()); if (old_dof_index != numbers::invalid_dof_index) - dealii::internal::DoFAccessorImplementation:: - Implementation::set_vertex_dof_index( - dof_handler, - vertex_index, - fe_index, - d, - (indices.size() == 0) ? - (new_numbers[old_dof_index]) : - (new_numbers[indices.index_within_set( - old_dof_index)])); + { + if (indices.size() == 0) + dealii::internal::DoFAccessorImplementation:: + Implementation::set_vertex_dof_index( + dof_handler, + vertex_index, + fe_index, + d, + new_numbers[old_dof_index]); + else + { + Assert(indices.is_element(old_dof_index), + ExcInternalError()); + dealii::internal::DoFAccessorImplementation:: + Implementation::set_vertex_dof_index( + dof_handler, + vertex_index, + fe_index, + d, + new_numbers[indices.index_within_set( + old_dof_index)]); + } + } } } } @@ -2639,13 +2652,22 @@ namespace internal const types::global_dof_index old_dof_index = cell->dof_index(d, fe_index); if (old_dof_index != numbers::invalid_dof_index) - cell->set_dof_index( - d, - (indices.size() == 0) ? - (new_numbers[old_dof_index]) : - (new_numbers[indices.index_within_set( - old_dof_index)]), - fe_index); + { + if (indices.size() == 0) + cell->set_dof_index(d, + new_numbers[old_dof_index], + fe_index); + else + { + Assert(indices.is_element(old_dof_index), + ExcInternalError()); + cell->set_dof_index( + d, + new_numbers[indices.index_within_set( + old_dof_index)], + fe_index); + } + } } } } @@ -2715,13 +2737,21 @@ namespace internal const types::global_dof_index old_dof_index = line->dof_index(d, fe_index); if (old_dof_index != numbers::invalid_dof_index) - line->set_dof_index( - d, - (indices.size() == 0) ? - (new_numbers[old_dof_index]) : - (new_numbers[indices.index_within_set( - old_dof_index)]), - fe_index); + { + if (indices.size() == 0) + line->set_dof_index( + d, new_numbers[old_dof_index], fe_index); + else + { + Assert(indices.is_element(old_dof_index), + ExcInternalError()); + line->set_dof_index( + d, + new_numbers[indices.index_within_set( + old_dof_index)], + fe_index); + } + } } } } -- 2.39.5