Skip to content
Snippets Groups Projects
Commit bc617adf authored by Oliver Sander's avatar Oliver Sander Committed by sander
Browse files

New hacky method to assemble the embedded Hessian into a SymmetricMatrix

[[Imported from SVN: r9584]]
parent 136afcdd
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,8 @@
#include <vector>
#include <dune/gfe/symmetricmatrix.hh>
/** \tparam TargetSpace The manifold that we are mapping to */
template <class TargetSpace, class WeightType=double>
class AverageDistanceAssembler
......@@ -75,6 +77,18 @@ public:
matrix.axpy(weights_[i], TargetSpace::secondDerivativeOfDistanceSquaredWRTSecondArgument(coefficients_[i], x));
}
void assembleEmbeddedHessian(const TargetSpace& x,
Dune::SymmetricMatrix<ctype,embeddedSize>& matrix) const
{
matrix = 0;
for (size_t i=0; i<coefficients_.size(); i++) {
Dune::FieldMatrix<ctype,embeddedSize,embeddedSize> tmp = TargetSpace::secondDerivativeOfDistanceSquaredWRTSecondArgument(coefficients_[i], x);
for (size_t j=0; j<embeddedSize; j++)
for (size_t k=0; k<=j; k++)
matrix(j,k) += weights_[i] * tmp[j][k];
}
}
void assembleHessian(const TargetSpace& x,
Dune::FieldMatrix<ctype,size,size>& matrix) const
{
......
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