From 1a1fb9ae9142ab20a43065ab47747aaf352e7c5b Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Tue, 31 Jul 2012 22:25:08 +0200
Subject: [PATCH] Ignore the nonlinearity in CircularConvexFunctions

---
 dune/tectonic/circularconvexfunction.hh | 15 +++------------
 dune/tectonic/ellipticenergy.hh         |  8 +++++---
 2 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/dune/tectonic/circularconvexfunction.hh b/dune/tectonic/circularconvexfunction.hh
index ba4f4071..ab721405 100644
--- a/dune/tectonic/circularconvexfunction.hh
+++ b/dune/tectonic/circularconvexfunction.hh
@@ -5,17 +5,12 @@
 #include <dune/fufem/interval.hh>
 
 namespace Dune {
-template <class NonlinearityType> class CircularConvexFunction {
-  typedef typename NonlinearityType::VectorType VectorType;
-  typedef typename NonlinearityType::MatrixType MatrixType;
-
+template <class MatrixType, class VectorType> class CircularConvexFunction {
 public:
   CircularConvexFunction(MatrixType const &A, VectorType const &b,
-                         NonlinearityType const &phi, VectorType const &x,
-                         VectorType const &dir)
+                         VectorType const &x, VectorType const &dir)
       : A(A),
         b(b),
-        phi(phi),
         x(x),
         dir(dir),
         xnorm(x.two_norm()),
@@ -31,14 +26,11 @@ template <class NonlinearityType> class CircularConvexFunction {
     VectorType t;
     tangent(m, t);
 
-    phi.directionalSubDiff(x, t, D);
-
     VectorType tmp;
     A.mv(x, tmp);                //  Ax
     tmp -= b;                    //  Ax - b
     double const dotp = tmp * t; // <Ax - b,t>
-    D[0] += dotp;
-    D[1] += dotp;
+    D[0] = D[1] = dotp;
   }
 
   void domain(Interval<double> &domain) const {
@@ -55,7 +47,6 @@ template <class NonlinearityType> class CircularConvexFunction {
 private:
   MatrixType const &A;
   VectorType const &b;
-  NonlinearityType const &phi;
   VectorType const &x;
   VectorType const &dir;
 
diff --git a/dune/tectonic/ellipticenergy.hh b/dune/tectonic/ellipticenergy.hh
index bb6f8749..f3edb15c 100644
--- a/dune/tectonic/ellipticenergy.hh
+++ b/dune/tectonic/ellipticenergy.hh
@@ -196,11 +196,13 @@ void tangentialMinimisation(Functional const &J,
                             typename Functional::SmallVector &x,
                             typename Functional::SmallVector const &descDir,
                             Bisection const &bisection) {
-  typedef typename Functional::NonlinearityType LocalNonlinearityType;
+  typedef typename Functional::SmallMatrix SmallMatrix;
   typedef typename Functional::SmallVector SmallVector;
 
-  CircularConvexFunction<LocalNonlinearityType> const JRest(J.A, J.b, *J.phi, x,
-                                                            descDir);
+  // We completely ignore the nonlinearity here -- when restricted
+  // to a circle, it just enters as a constant!
+  CircularConvexFunction<SmallMatrix, SmallVector> const JRest(J.A, J.b, x,
+                                                               descDir);
 
   int count;
   double const stepsize = bisection.minimize(JRest, 0.0, 1.0, count);
-- 
GitLab