From e6dca29a97830bb0fa9c35c2bfedd99336e1d636 Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@igpm.rwth-aachen.de>
Date: Mon, 24 Mar 2014 15:51:32 +0000
Subject: [PATCH] Use a better initial iterate for the TargetSpaceTRSolver than
 coefficients_[0]

The new initial iterate is constructed by interpolating the values in Euclidean
space, and projecting back onto TargetSpace.  This has two advantages:
1) It's a better initial iterate, so we should converge faster than starting
   from coefficients_[0]
2) It makes it easier for ADOL-C to pick up correct second derivatives.
   Hence we are able to reduce the minimum number of iterations of the
   target space tr solver.

[[Imported from SVN: r9683]]
---
 dune/gfe/localgeodesicfefunction.hh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/dune/gfe/localgeodesicfefunction.hh b/dune/gfe/localgeodesicfefunction.hh
index 9eadf45e..9316ff48 100644
--- a/dune/gfe/localgeodesicfefunction.hh
+++ b/dune/gfe/localgeodesicfefunction.hh
@@ -9,6 +9,7 @@
 
 #include <dune/gfe/averagedistanceassembler.hh>
 #include <dune/gfe/targetspacertrsolver.hh>
+#include <dune/gfe/localprojectedfefunction.hh>
 #include <dune/gfe/rigidbodymotion.hh>
 
 #include <dune/gfe/tensor3.hh>
@@ -187,10 +188,15 @@ evaluate(const Dune::FieldVector<ctype, dim>& local) const
     // The energy functional whose mimimizer is the value of the geodesic interpolation
     AverageDistanceAssembler<TargetSpace> assembler(coefficients_, w);
 
+    // Create a reasonable initial iterate for the iterative solver
+    Dune::GFE::LocalProjectedFEFunction<dim,ctype,LocalFiniteElement,TargetSpace> localProjectedFEFunction(localFiniteElement_, coefficients_);
+    TargetSpace initialIterate = localProjectedFEFunction.evaluate(local);
+
+    // Iteratively solve the GFE minimization problem
     TargetSpaceRiemannianTRSolver<TargetSpace> solver;
 
     solver.setup(&assembler,
-                 coefficients_[0],   // initial iterate
+                 initialIterate,
                  1e-14,    // tolerance
                  100,      // maxTrustRegionSteps
                  2,       // initial trust region radius
-- 
GitLab