From 270bdb3009695df197a2aca16c868115bd919068 Mon Sep 17 00:00:00 2001
From: Markus Blatt <mblatt@dune-project.org>
Date: Wed, 3 Nov 2010 16:04:34 +0000
Subject: [PATCH] Support parallel recalculation of galerkin product.

[[Imported from SVN: r1348]]
---
 dune/istl/paamg/hierarchy.hh | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/dune/istl/paamg/hierarchy.hh b/dune/istl/paamg/hierarchy.hh
index afa526a51..9c2c747a6 100644
--- a/dune/istl/paamg/hierarchy.hh
+++ b/dune/istl/paamg/hierarchy.hh
@@ -729,7 +729,6 @@ namespace Dune
                                         RedistributeInformation<SequentialInformation>& ri)
     {
       return true;
-
     }
 
     template<class M, class IS, class A>
@@ -1247,13 +1246,29 @@ namespace Dune
       AggregatesMapIterator amap = aggregatesMaps_.begin();
       BaseGalerkinProduct productBuilder;
       InfoIterator info = parallelInformation_.finest();
+      typename RedistributeInfoList::iterator riIter = redistributes_.begin();
+      Iterator level = matrices_.finest(), coarsest=matrices_.coarsest();
+      if(level.isRedistributed()) {
+        info->buildGlobalLookup(info->indexSet().size());
+        redistributeMatrixEntries(const_cast<Matrix&>(level->getmat()),
+                                  const_cast<Matrix&>(level.getRedistributed().getmat()),
+                                  *info,info.getRedistributed(), *riIter);
+        info->freeGlobalLookup();
+      }
 
-      for(Iterator level = matrices_.finest(), coarsest=matrices_.coarsest(); level!=coarsest; ++amap) {
-        const Matrix& fine = level->getmat();
+      for(; level!=coarsest; ++amap) {
+        const Matrix& fine = (level.isRedistributed() ? level.getRedistributed() : *level).getmat();
         ++level;
         ++info;
+        ++riIter;
         productBuilder.calculate(fine, *(*amap), const_cast<Matrix&>(level->getmat()), *info, copyFlags);
-
+        if(level.isRedistributed()) {
+          info->buildGlobalLookup(info->indexSet().size());
+          redistributeMatrixEntries(const_cast<Matrix&>(level->getmat()),
+                                    const_cast<Matrix&>(level.getRedistributed().getmat()), *info,
+                                    info.getRedistributed(), *riIter);
+          info->freeGlobalLookup();
+        }
       }
     }
 
-- 
GitLab