From 80f4558b6e23e4bbe1ccea31b434db828706b710 Mon Sep 17 00:00:00 2001
From: Markus Blatt <mblatt@dune-project.org>
Date: Tue, 6 Sep 2005 14:06:37 +0000
Subject: [PATCH] used an ugly const_cast to recalculate Galerkin product.

[[Imported from SVN: r2771]]
---
 istl/paamg/hierarchy.hh          | 6 +++---
 istl/paamg/pmatrix.hh            | 7 +++----
 istl/paamg/test/hierarchytest.cc | 3 +++
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/istl/paamg/hierarchy.hh b/istl/paamg/hierarchy.hh
index 03fdaff99..2d5fc8396 100644
--- a/istl/paamg/hierarchy.hh
+++ b/istl/paamg/hierarchy.hh
@@ -554,10 +554,10 @@ namespace Dune
       GalerkinProduct productBuilder;
 
       for(Iterator level = matrices_.finest(), coarsest=matrices_.coarsest(); level!=coarsest; ++amap) {
-        Matrix& fine = level->matrix();
+        const Matrix& fine = level->matrix();
         ++level;
-        Matrix& coarse = level->matrix();
-        productBuilder.calculate(fine, *(*amap), coarse);
+        //Matrix& coarse(level->matrix());
+        productBuilder.calculate(fine, *(*amap), const_cast<Matrix&>(level->matrix()));
 
       }
     }
diff --git a/istl/paamg/pmatrix.hh b/istl/paamg/pmatrix.hh
index b107fe8ef..cde17ff72 100644
--- a/istl/paamg/pmatrix.hh
+++ b/istl/paamg/pmatrix.hh
@@ -40,16 +40,15 @@ namespace Dune
        * @brief Get the locally stored matrix.
        * @return The locally stored matrix.
        */
-      const Matrix& matrix()
+      const Matrix& matrix() const
       {
         return *matrix_;
       }
-
       /**
        * @brief Get the index set that maps global indices to matrix rows.
        *  @return The index set.
        */
-      const IndexSet& indexSet()
+      const IndexSet& indexSet() const
       {
         return *indices_;
       }
@@ -58,7 +57,7 @@ namespace Dune
        * @brief Get the information about remote indices also present locally.
        * @return The remote index information.
        */
-      const RemoteIndices& remoteIndices()
+      const RemoteIndices& remoteIndices() const
       {
         return *rIndices_;
       }
diff --git a/istl/paamg/test/hierarchytest.cc b/istl/paamg/test/hierarchytest.cc
index f63f0851d..ac5badd73 100644
--- a/istl/paamg/test/hierarchytest.cc
+++ b/istl/paamg/test/hierarchytest.cc
@@ -41,6 +41,9 @@ int main(int argc, char** argv)
 
   hierarchy.build(criterion);
 
+  hierarchy.recalculateGalerkin();
+
+
   MPI_Finalize();
 
 }
-- 
GitLab