From 8f55ab9cb4067ce23e8db50752769020e730d94d Mon Sep 17 00:00:00 2001
From: Jonathan Youett <youett@mi.fu-berlin.de>
Date: Fri, 19 Apr 2013 15:39:56 +0000
Subject: [PATCH] bugfix: indices were computed wrong

[[Imported from SVN: r11298]]
---
 dune/elasticity/assemblers/neohookeoperatorassembler.hh | 2 +-
 dune/elasticity/common/elasticityhelpers.hh             | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dune/elasticity/assemblers/neohookeoperatorassembler.hh b/dune/elasticity/assemblers/neohookeoperatorassembler.hh
index 192ece1..0f1b5b0 100644
--- a/dune/elasticity/assemblers/neohookeoperatorassembler.hh
+++ b/dune/elasticity/assemblers/neohookeoperatorassembler.hh
@@ -210,7 +210,7 @@ private:
         // the resulting matrix is skew symmetric with entries <cross,degGrad[i]>
         for (int i=0; i<dim; i++)
             for (int j=i+1; j<dim; j++) {
-                int k= (-(i+j))%dim;
+                int k= (dim-(i+j))%dim;
             res[i][j] = (cross*defGrad[k])*std::pow(-1,k);
             res[j][i] = -res[i][j];
         }
diff --git a/dune/elasticity/common/elasticityhelpers.hh b/dune/elasticity/common/elasticityhelpers.hh
index 1980373..329ad77 100644
--- a/dune/elasticity/common/elasticityhelpers.hh
+++ b/dune/elasticity/common/elasticityhelpers.hh
@@ -134,8 +134,8 @@ namespace Dune {
 
             linDet = 0;
             for (int i=0; i<2; i++)                       
-                for (int j=(i+1)%3; j<3; j++) {
-                    int k=(-(i+j))%3;
+                for (int j=i+1; j<3; j++) {
+                    int k=(3-(i+j))%3;
                     linDet[i][j] = u[j][k]*u[k][i] - u[j][i]*(1+u[k][k]);
                     linDet[j][i] = u[k][j]*u[i][k] - u[i][j]*(1+u[k][k]);
             }    
-- 
GitLab