From 29943ed701089662bb10aaded0a6259b72a8e893 Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@igpm.rwth-aachen.de>
Date: Wed, 15 Feb 2012 17:01:46 +0000
Subject: [PATCH] Fix an index bug in
 evaluateFDDerivativeOfGradientWRTCoefficient

This change makes the localgeodesicfefunction test fail again.
So there must be a bug in the corresponding non-finite-difference
code.  Looking at simplex cases confirms me in this opinion.
But I don't find the bug...

[[Imported from SVN: r8463]]
---
 dune/gfe/localgeodesicfefunction.hh | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/dune/gfe/localgeodesicfefunction.hh b/dune/gfe/localgeodesicfefunction.hh
index 3198568c..fc8d0abd 100644
--- a/dune/gfe/localgeodesicfefunction.hh
+++ b/dune/gfe/localgeodesicfefunction.hh
@@ -549,18 +549,22 @@ evaluateFDDerivativeOfGradientWRTCoefficient(const Dune::FieldVector<ctype, dim>
         result[j]  = hPlus;
         result[j] -= hMinus;
         result[j] /= 2*eps;
-                
+
+    }
+    
+    for (int j=0; j<embeddedDim; j++) {
+
         TargetSpace q = evaluate(local);
         Dune::FieldVector<double,embeddedDim> foo;
         for (int l=0; l<dim; l++) {
                     
             for (int k=0; k<embeddedDim; k++)
-                foo[k] = result[j][k][l];
+                foo[k] = result[k][j][l];
 
             foo = q.projectOntoTangentSpace(foo);
 
             for (int k=0; k<embeddedDim; k++)
-                result[j][k][l] = foo[k];
+                result[k][j][l] = foo[k];
                     
         }
         
-- 
GitLab