From 3d8c79a185bf1b48cf784df493dd6bbda5fa8b15 Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Wed, 12 Apr 2017 15:05:35 +0200
Subject: [PATCH] [NL/DOF] Sum loc. part of norm and distri. result.

---
 NumLib/DOF/DOFTableUtil.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/NumLib/DOF/DOFTableUtil.cpp b/NumLib/DOF/DOFTableUtil.cpp
index 72196575608..8168e07625a 100644
--- a/NumLib/DOF/DOFTableUtil.cpp
+++ b/NumLib/DOF/DOFTableUtil.cpp
@@ -36,7 +36,12 @@ double norm(GlobalVector const& x, unsigned const global_component,
         }
     }
 
-    // TODO for PETSc some global accumulation is necessary.
+#ifdef USE_PETSC
+    double global_result = 0.0;
+    MPI_Allreduce(&res, &global_result, 1, MPI_DOUBLE, MPI_SUM,
+                  PETSC_COMM_WORLD);
+    res = global_result;
+#endif
     return res;
 }
 
-- 
GitLab