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

implement fd gradient

[[Imported from SVN: r5571]]
parent e107effc
No related branches found
No related tags found
No related merge requests found
...@@ -304,14 +304,11 @@ class LocalGeodesicFEStiffness <GridView,UnitVector<dim> > ...@@ -304,14 +304,11 @@ class LocalGeodesicFEStiffness <GridView,UnitVector<dim> >
/** \brief For the fd approximations /** \brief For the fd approximations
*/ */
static void infinitesimalVariation(UnitVector<dim>& c, double eps, int i) static Dune::FieldVector<double,dim> infinitesimalVariation(UnitVector<dim>& c, double eps, int i)
{ {
DUNE_THROW(Dune::NotImplemented, "infinitesimalVariation"); Dune::FieldVector<double,dim> result = c.globalCoordinates();
#if 0 result[i] += eps;
c = c.mult(Rotation<3,double>::exp((i==0)*eps, return result;
(i==1)*eps,
(i==2)*eps));
#endif
} }
public: public:
...@@ -373,8 +370,7 @@ assembleGradient(const Entity& element, ...@@ -373,8 +370,7 @@ assembleGradient(const Entity& element,
const std::vector<TargetSpace>& localSolution, const std::vector<TargetSpace>& localSolution,
std::vector<Dune::FieldVector<double,blocksize> >& localGradient) const std::vector<Dune::FieldVector<double,blocksize> >& localGradient) const
{ {
DUNE_THROW(Dune::NotImplemented, "!");
#if 0
// /////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////
// Compute gradient by finite-difference approximation // Compute gradient by finite-difference approximation
// /////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////
...@@ -399,9 +395,12 @@ assembleGradient(const Entity& element, ...@@ -399,9 +395,12 @@ assembleGradient(const Entity& element,
forwardSolution[i] = localSolution[i]; forwardSolution[i] = localSolution[i];
backwardSolution[i] = localSolution[i]; backwardSolution[i] = localSolution[i];
} }
// Project gradient in embedding space onto the tangent space
localGradient[i] = localSolution[i].projectOntoTangentSpace(localGradient[i]);
} }
#endif
} }
...@@ -410,8 +409,7 @@ void LocalGeodesicFEStiffness<GridType,UnitVector<dim> >:: ...@@ -410,8 +409,7 @@ void LocalGeodesicFEStiffness<GridType,UnitVector<dim> >::
assemble(const Entity& element, assemble(const Entity& element,
const std::vector<TargetSpace>& localSolution) const std::vector<TargetSpace>& localSolution)
{ {
DUNE_THROW(Dune::NotImplemented, "!"); #warning Dummy Hessian implementation
#if 0
// 1 degree of freedom per element vertex // 1 degree of freedom per element vertex
int nDofs = element.template count<gridDim>(); int nDofs = element.template count<gridDim>();
...@@ -421,6 +419,10 @@ assemble(const Entity& element, ...@@ -421,6 +419,10 @@ assemble(const Entity& element,
this->A = 0; this->A = 0;
for (int i=0; i<nDofs; i++)
for (int j=0; j<blocksize; j++)
this->A[i][i][j][j] = 1;
#if 0
double eps = 1e-4; double eps = 1e-4;
typedef typename Dune::Matrix<Dune::FieldMatrix<double,blocksize,blocksize> >::row_type::iterator ColumnIterator; typedef typename Dune::Matrix<Dune::FieldMatrix<double,blocksize,blocksize> >::row_type::iterator ColumnIterator;
......
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