From 795eb1bbed94866f8a0f2b06558c7d9ab84d4e09 Mon Sep 17 00:00:00 2001 From: Klaus <klaus.boehnlein@tu-dresden.de> Date: Sun, 1 Dec 2024 14:16:42 +0100 Subject: [PATCH] move 'convertFieldMatrix' method for matrix conversion to adouble into matrix_operations.hh --- dune/microstructure/matrix_operations.hh | 25 +++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/dune/microstructure/matrix_operations.hh b/dune/microstructure/matrix_operations.hh index 4e0a89c0..e99a6112 100644 --- a/dune/microstructure/matrix_operations.hh +++ b/dune/microstructure/matrix_operations.hh @@ -8,6 +8,7 @@ namespace MatrixOperations { using std::sin; using std::cos; + static MatrixRT sym (MatrixRT M) { // 1/2 (M^T + M) @@ -25,7 +26,6 @@ namespace MatrixOperations { } - 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]}; } @@ -207,6 +207,29 @@ namespace MatrixOperations { } + /** + * @brief This is used to convert FieldMatrices to 'adouble' + * since adouble-type can not be read from ParSet. + * is there a better way? + * + * @tparam Rtype + * @tparam IMatrixType + * @param A + * @param B + */ + template<class Rtype> + static void convertFieldMatrix(auto& A, + auto& B) + { + for(size_t i=0; i<B.N(); i++) + for(size_t j=0; j<B.M(); j++) + B[i][j] = (Rtype)A[i][j]; + + return; + } + + + } #endif -- GitLab