From 28464781173da1a6f4a2ff1247deeec36e41e1d9 Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@dune-project.org>
Date: Tue, 22 Mar 2005 11:22:28 +0000
Subject: [PATCH] discrete functions spaces only get a const reference to the
 grid

[[Imported from SVN: r1714]]
---
 fem/common/discretefunctionspace.hh | 8 ++++----
 fem/lagrangebase.hh                 | 2 +-
 fem/lagrangebase/lagrangespace.cc   | 2 +-
 fem/transfer/multigridtransfer.cc   | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/fem/common/discretefunctionspace.hh b/fem/common/discretefunctionspace.hh
index 70c5911c8..470493c12 100644
--- a/fem/common/discretefunctionspace.hh
+++ b/fem/common/discretefunctionspace.hh
@@ -73,7 +73,7 @@ namespace Dune {
     typedef GridTemp GridType;
 
     //! Constructor
-    DiscreteFunctionSpaceInterface ( GridType & g, int ident, int level ) :
+    DiscreteFunctionSpaceInterface (const GridType & g, int ident, int level ) :
       FunctionSpaceType (ident),  grid_ (g), level_(level) {};
 
     //! Get base function set for given entity.
@@ -105,7 +105,7 @@ namespace Dune {
     }
 
     //! return the corresponding Grid
-    GridType & getGrid () const { return grid_; }
+    const GridType & getGrid () const { return grid_; }
 
     //! return number of degrees of freedom for spezified grid and level
     //! which can also be the leaflevel and furthermore
@@ -141,7 +141,7 @@ namespace Dune {
     }
 
     //! the corresponding Grid
-    GridType & grid_ ;
+    const GridType & grid_ ;
 
     //! The grid level
     int level_;
@@ -165,7 +165,7 @@ namespace Dune {
 
   public:
     // at the moment nothing
-    DiscreteFunctionSpaceDefault(GridTemp& g, int id, int level)
+    DiscreteFunctionSpaceDefault(const GridTemp& g, int id, int level)
       : DiscreteFunctionSpaceInterface < FunctionSpaceType , GridTemp,
             DiscreteFunctionSpaceImp, BaseFunctionSetInter>(g, id, level)
     {}
diff --git a/fem/lagrangebase.hh b/fem/lagrangebase.hh
index 69821997b..b0f72368b 100644
--- a/fem/lagrangebase.hh
+++ b/fem/lagrangebase.hh
@@ -86,7 +86,7 @@ namespace Dune {
 
     //! Constructor generating for each different element type of the grid a
     //! LagrangeBaseSet with polOrd
-    LagrangeDiscreteFunctionSpace ( GridType & g, IndexSetType & iset , DofManagerType & dm , int level );
+    LagrangeDiscreteFunctionSpace ( const GridType & g, IndexSetType & iset , DofManagerType & dm , int level );
 
     //! return max number of baseset that holds this space
     int maxNumberBase () const;
diff --git a/fem/lagrangebase/lagrangespace.cc b/fem/lagrangebase/lagrangespace.cc
index 1c55dc2be..eece311bd 100644
--- a/fem/lagrangebase/lagrangespace.cc
+++ b/fem/lagrangebase/lagrangespace.cc
@@ -10,7 +10,7 @@ namespace Dune {
   // Constructor
   template< class FunctionSpaceT, class GridType, class IndexSetType , int polOrd, class DofManagerType >
   inline LagrangeDiscreteFunctionSpace<FunctionSpaceT,GridType,IndexSetType,polOrd,DofManagerType>::
-  LagrangeDiscreteFunctionSpace ( GridType & g, IndexSetType & iset, DofManagerType & dm , int level) :
+  LagrangeDiscreteFunctionSpace (const GridType & g, IndexSetType & iset, DofManagerType & dm , int level) :
     DiscreteFunctionSpaceType (g,id, level) , dm_ ( dm ) , indexSet_ (iset)
   {
     // add index set to list of indexset of dofmanager
diff --git a/fem/transfer/multigridtransfer.cc b/fem/transfer/multigridtransfer.cc
index f5bcfa05e..de3c13827 100644
--- a/fem/transfer/multigridtransfer.cc
+++ b/fem/transfer/multigridtransfer.cc
@@ -15,7 +15,7 @@ void Dune::MultiGridTransfer<DiscFuncType>::setup(const FunctionSpaceType& coars
     DUNE_THROW(Exception, "The two function spaces don't belong to consecutive levels!");
 
   typedef typename FunctionSpaceType::GridType GridType;
-  GridType& grid = coarseFSpace.getGrid();
+  const GridType& grid = coarseFSpace.getGrid();
   if (&grid != &(fineFSpace.getGrid()))
     DUNE_THROW(Exception, "The two function spaces don't belong to the same grid!");
 
-- 
GitLab