From aec943fd6554609a8be0c17f345434eb7de70aef Mon Sep 17 00:00:00 2001
From: Oliver Sander <oliver.sander@tu-dresden.de>
Date: Fri, 29 Sep 2023 15:44:13 +0200
Subject: [PATCH] Replace hand-written identity matrix by ScaledIdentityMatrix

Yes, it is debatable whether that change makes the code more readable.
---
 dune/microstructure/matrix_operations.hh | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/dune/microstructure/matrix_operations.hh b/dune/microstructure/matrix_operations.hh
index 83fd5a72..1796b1b2 100644
--- a/dune/microstructure/matrix_operations.hh
+++ b/dune/microstructure/matrix_operations.hh
@@ -9,13 +9,6 @@ namespace MatrixOperations {
 	using std::sin;
 	using std::cos;
 
-	static MatrixRT Id (){ 
-		MatrixRT Id(0);
-	    for (int i=0;i<3;i++)
-	        Id[i][i]=1.0;
-	    return Id;
-	}
-	
 	// static MatrixRT sym (MatrixRT M) { // 1/2 (M^T + M)
     // 	MatrixRT ret(0);
     // 	for (int i = 0; i< 3; i++)
@@ -168,7 +161,7 @@ namespace MatrixOperations {
 // // 	
     static double linearizedStVenantKirchhoffDensity(double mu, double lambda, MatrixRT E1, MatrixRT E2)  // CHANGED
     {  
-        auto t1 = 2.0 * mu * sym(E1) + lambda * trace(sym(E1)) * Id();
+        auto t1 = 2.0 * mu * sym(E1) + MatrixRT(Dune::ScaledIdentityMatrix<double,3>(lambda * trace(sym(E1))));
         auto tmp1 = scalarProduct(t1,sym(E2));
         // auto tmp1 = scalarProduct(t1,E2);
 //         auto t2 = 2.0 * mu * sym(E2) + lambda * trace(sym(E2)) * Id();
-- 
GitLab