From c406409a93704650850019a6371fced6717c3a7f Mon Sep 17 00:00:00 2001
From: peterrum <peterrmuench@gmail.com>
Date: Sat, 20 Jul 2019 11:37:54 +0200
Subject: [PATCH] Add assert to Utilities::MPI::compute_index_owner to check
 the equality of the size of the index sets on all processes

---
 source/base/mpi.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/source/base/mpi.cc b/source/base/mpi.cc
index 986d4007a3..63c6a010e3 100644
--- a/source/base/mpi.cc
+++ b/source/base/mpi.cc
@@ -1724,6 +1724,10 @@ namespace Utilities
       Assert(owned_indices.size() == indices_to_look_up.size(),
              ExcMessage("IndexSets have to have the same sizes."));
 
+      Assert(
+        owned_indices.size() == Utilities::MPI::max(owned_indices.size(), comm),
+        ExcMessage("IndexSets have to have the same size on all processes."));
+
       std::vector<unsigned int> owning_ranks(indices_to_look_up.n_elements());
 
       // Step 1: setup dictionary
-- 
2.39.5