Skip to content
Snippets Groups Projects
Commit c1b97063 authored by Oliver Sander's avatar Oliver Sander Committed by sander@FU-BERLIN.DE
Browse files

add method to assemble the gradient in local coordinates, not embedded coordinates

[[Imported from SVN: r6498]]
parent 680fdbac
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,10 @@ public: ...@@ -35,6 +35,10 @@ public:
virtual void assembleEmbeddedGradient(const Entity& element, virtual void assembleEmbeddedGradient(const Entity& element,
const std::vector<TargetSpace>& solution, const std::vector<TargetSpace>& solution,
std::vector<typename TargetSpace::EmbeddedTangentVector>& gradient) const; std::vector<typename TargetSpace::EmbeddedTangentVector>& gradient) const;
virtual void assembleGradient(const Entity& element,
const std::vector<TargetSpace>& localSolution,
std::vector<typename TargetSpace::TangentVector>& localGradient) const;
#endif #endif
}; };
...@@ -109,7 +113,7 @@ assembleEmbeddedGradient(const Entity& element, ...@@ -109,7 +113,7 @@ assembleEmbeddedGradient(const Entity& element,
{ {
// initialize gradient // initialize gradient
localGradient.resize(localSolution.size()); localGradient.resize(localSolution.size());
std::fill(localGradient.begin(), localGradient.end(), typename TargetSpace::TangentVector(0)); std::fill(localGradient.begin(), localGradient.end(), typename TargetSpace::EmbeddedTangentVector(0));
// Set up local gfe function from the local coefficients // Set up local gfe function from the local coefficients
LocalGeodesicFEFunction<gridDim, double, TargetSpace> localGeodesicFEFunction(localSolution); LocalGeodesicFEFunction<gridDim, double, TargetSpace> localGeodesicFEFunction(localSolution);
...@@ -161,6 +165,25 @@ assembleEmbeddedGradient(const Entity& element, ...@@ -161,6 +165,25 @@ assembleEmbeddedGradient(const Entity& element,
} }
}
template <class GridView, class TargetSpace>
void HarmonicEnergyLocalStiffness<GridView, TargetSpace>::
assembleGradient(const Entity& element,
const std::vector<TargetSpace>& localSolution,
std::vector<typename TargetSpace::TangentVector>& localGradient) const
{
std::vector<typename TargetSpace::EmbeddedTangentVector> embeddedLocalGradient;
// first compute the gradient in embedded coordinates
assembleEmbeddedGradient(element, localSolution, embeddedLocalGradient);
// transform to coordinates on the tangent space
localGradient.resize(embeddedLocalGradient.size());
for (size_t i=0; i<localGradient.size(); i++)
localSolution[i].orthonormalFrame().mv(embeddedLocalGradient[i], localGradient[i]);
} }
#endif #endif
#endif #endif
......
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