From b935cf1a87b6271d3cfd27cd28b869badc758fec Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Mon, 14 Nov 2011 08:54:25 +0100
Subject: [PATCH] Use a pointer instead of a reference

---
 dune/tectonic/localnonlinearity.hh | 20 ++++++++++----------
 dune/tectonic/myblockproblem.hh    |  2 +-
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/dune/tectonic/localnonlinearity.hh b/dune/tectonic/localnonlinearity.hh
index 0f182ef2..195dbe7d 100644
--- a/dune/tectonic/localnonlinearity.hh
+++ b/dune/tectonic/localnonlinearity.hh
@@ -18,11 +18,11 @@ template <int dimension> class LocalNonlinearity {
   typedef FieldVector<double, dimension> VectorType;
   typedef FieldMatrix<double, dimension, dimension> MatrixType;
 
-  LocalNonlinearity(NiceFunction const &func) : func_(func) {}
+  LocalNonlinearity(NiceFunction const *func) : func_(func) {}
 
   double operator()(VectorType const x) const {
     double ret;
-    func_.evaluate(x.two_norm(), ret);
+    func_->evaluate(x.two_norm(), ret);
     return ret;
   }
 
@@ -31,29 +31,29 @@ template <int dimension> class LocalNonlinearity {
   void directionalSubDiff(VectorType const u, VectorType const v,
                           Interval<double> &D) const {
     if (u.two_norm() == 0) {
-      D[0] = D[1] = func_.rightDifferential(0) * v.two_norm();
+      D[0] = D[1] = func_->rightDifferential(0) * v.two_norm();
       return;
     }
     double const un = u.two_norm();
     double const ndotp = (u * v) / un;
     // Our coordinate system is now such that v is a unit vector!
     if (ndotp > 0) {
-      D[1] = ndotp * func_.rightDifferential(un);
-      D[0] = ndotp * func_.leftDifferential(un);
+      D[1] = ndotp * func_->rightDifferential(un);
+      D[0] = ndotp * func_->leftDifferential(un);
     } else {
-      D[1] = ndotp * func_.leftDifferential(un);
-      D[0] = ndotp * func_.rightDifferential(un);
+      D[1] = ndotp * func_->leftDifferential(un);
+      D[0] = ndotp * func_->rightDifferential(un);
     }
   }
 
   void upperGradient(VectorType const x, VectorType &ret) const {
     ret = x;
-    ret *= func_.rightDifferential(x.two_norm()) / x.two_norm();
+    ret *= func_->rightDifferential(x.two_norm()) / x.two_norm();
   }
 
   void lowerGradient(VectorType const x, VectorType &ret) const {
     ret = x;
-    ret *= func_.leftDifferential(x.two_norm()) / x.two_norm();
+    ret *= func_->leftDifferential(x.two_norm()) / x.two_norm();
   }
 
   void directionalDomain(VectorType const &, VectorType const &,
@@ -63,7 +63,7 @@ template <int dimension> class LocalNonlinearity {
   }
 
 private:
-  NiceFunction const &func_;
+  NiceFunction const *func_;
 };
 }
 #endif
diff --git a/dune/tectonic/myblockproblem.hh b/dune/tectonic/myblockproblem.hh
index e4ff4a5d..842bd73b 100644
--- a/dune/tectonic/myblockproblem.hh
+++ b/dune/tectonic/myblockproblem.hh
@@ -114,7 +114,7 @@ class MyBlockProblem<MyConvexProblemTypeTEMPLATE>::IterateObject {
       assert(localA != NULL);
 
       auto const f = problem.phi.restriction(m);
-      Dune::LocalNonlinearity<block_size> const phi(*f);
+      Dune::LocalNonlinearity<block_size> const phi(f);
       Dune::SampleFunctional<block_size> localJ(*localA, localb, phi,
                                                 ignore_component);
 
-- 
GitLab