From 5a7073f6e2cc61e5e46b0c6db81327c8b98a4873 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 7 Jul 2017 14:00:02 -0600 Subject: [PATCH] Relax a couple of assertions for parallel cases. The code I replace it by here is taken verbatim from the ::DoFHandler class, so seems correct and well tested. --- source/hp/dof_handler.cc | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/source/hp/dof_handler.cc b/source/hp/dof_handler.cc index 344c71a31c..7c6896d0de 100644 --- a/source/hp/dof_handler.cc +++ b/source/hp/dof_handler.cc @@ -1620,18 +1620,34 @@ namespace hp template void DoFHandler::renumber_dofs (const std::vector &new_numbers) { - Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete()); + Assert(levels.size()>0, ExcMessage("You need to distribute DoFs before you can renumber them.")); + + Assert (new_numbers.size() == n_locally_owned_dofs(), + ExcRenumberingIncomplete()); + #ifdef DEBUG - // assert that the new indices are consecutively numbered - if (true) + // assert that the new indices are + // consecutively numbered if we are + // working on a single + // processor. this doesn't need to + // hold in the case of a parallel + // mesh since we map the interval + // [0...n_dofs()) into itself but + // only globally, not on each + // processor + if (n_locally_owned_dofs() == n_dofs()) { std::vector tmp(new_numbers); std::sort (tmp.begin(), tmp.end()); std::vector::const_iterator p = tmp.begin(); - types::global_dof_index i = 0; + types::global_dof_index i = 0; for (; p!=tmp.end(); ++p, ++i) Assert (*p == i, ExcNewNumbersNotConsecutive(i)); } + else + for (types::global_dof_index i=0; i