diff --git a/dune/microstructure/matrix_operations.hh b/dune/microstructure/matrix_operations.hh index 33b1e590b86f40a24b331ee1243e89c335e02ca4..577a151cde9d8306b1071f129ac1832d2023c8ef 100644 --- a/dune/microstructure/matrix_operations.hh +++ b/dune/microstructure/matrix_operations.hh @@ -31,14 +31,31 @@ namespace MatrixOperations { } + // static MatrixRT sym (MatrixRT M) { // 1/2 (M^T + M) + // MatrixRT ret(0); + // for (int i = 0; i< 3; i++) + // for (int j = 0; j< 3; j++) + // ret[i][j] = 0.5 * (M[i][j] + M[j][i]); + // return ret; + // } + + static MatrixRT sym (MatrixRT M) { // 1/2 (M^T + M) MatrixRT ret(0); - for (int i = 0; i< 3; i++) - for (int j = 0; j< 3; j++) - ret[i][j] = 0.5 * (M[i][j] + M[j][i]); + for (int i=0; i<3; i++) + { + ret[i][i] = M[i][i]; + for (int j=i+1; j<3; j++) + { + ret[i][j] = 0.5*(M[i][j] + M[j][i]); + ret[j][i] = ret[i][j]; + } + } return ret; } + + static VectorRT crossProduct (VectorRT v, VectorRT w) { // v otimes w return {v[1]*w[2] - v[2]*w[1], -1*(v[0]*w[2] - v[2]*w[0]), v[0]*w[1] - v[1]*w[0]}; }