From 724ea8012e4c11c73a4eec304bcc09299bd4bb21 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 18 Jul 2017 18:36:08 -0600 Subject: [PATCH] Simplify an assertion. --- source/dofs/dof_handler_policy.cc | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/source/dofs/dof_handler_policy.cc b/source/dofs/dof_handler_policy.cc index 936fc332eb..637ea607a2 100644 --- a/source/dofs/dof_handler_policy.cc +++ b/source/dofs/dof_handler_policy.cc @@ -3426,21 +3426,14 @@ namespace internal } -#ifdef DEBUG - { - // check that all messages got sent and received - unsigned int sum_send=0; - unsigned int sum_recv=0; - unsigned int sent=needs_to_get_cells.size(); - unsigned int recv=senders.size(); - int ierr = MPI_Allreduce(&sent, &sum_send, 1, MPI_UNSIGNED, MPI_SUM, triangulation->get_communicator()); - AssertThrowMPI(ierr); - ierr = MPI_Allreduce(&recv, &sum_recv, 1, MPI_UNSIGNED, MPI_SUM, triangulation->get_communicator()); - AssertThrowMPI(ierr); - Assert(sum_send==sum_recv, ExcInternalError()); - } -#endif + // check that all messages got sent and received + Assert (Utilities::MPI::sum (needs_to_get_cells.size(), + triangulation->get_communicator()) + == + Utilities::MPI::sum (senders.size(), + triangulation->get_communicator()), + ExcInternalError()); // have a barrier so that sends between two calls to this // function are not mixed up. -- 2.39.5