Skip to content
Snippets Groups Projects
Commit 7a00ee21 authored by Sander, Oliver's avatar Sander, Oliver
Browse files

Properly convert SymmetricMatrix to FieldMatrix

parent 7b58d8a6
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
#define DUNE_GFE_SYMMETRICMATRIX_HH
#include <dune/common/fvector.hh>
#include <dune/common/fmatrix.hh>
namespace Dune {
......@@ -79,6 +80,17 @@ public:
data_.axpy(a,other.data_);
}
/** \brief Return the FieldMatrix representation of the symmetric tensor.*/
Dune::FieldMatrix<T,N,N> matrix() const
{
Dune::FieldMatrix<T,N,N> mat;
for (int i=0; i<N; i++)
for (int j=0; j<=i; j++)
mat[j][i] = mat[i][j] = this->operator()(i,j);
return mat;
}
private:
Dune::FieldVector<T,N*(N+1)/2> data_;
};
......
......@@ -151,10 +151,10 @@ void testHessian()
embeddedHessian = 0;
embeddedHessian[0][0] = TargetSpace::secondDerivativeOfDistanceSquaredWRTSecondArgument(coefficients[1],
coefficients[0]);
coefficients[0]).matrix();
embeddedHessian[1][1] = TargetSpace::secondDerivativeOfDistanceSquaredWRTSecondArgument(coefficients[0],
coefficients[1]);
coefficients[1]).matrix();
embeddedHessian[0][1] = TargetSpace::secondDerivativeOfDistanceSquaredWRTFirstAndSecondArgument(coefficients[0],
coefficients[1]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment