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

let the base class compute the overall energy

[[Imported from SVN: r5086]]
parent 172d3cd7
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@
#include "src/rodlocalstiffness.hh"
template <class GridType>
void RodAssembler<GridType>::
assembleGradient(const std::vector<RigidBodyMotion<3> >& sol,
......@@ -72,32 +73,9 @@ template <class GridType>
double RodAssembler<GridType>::
computeEnergy(const std::vector<RigidBodyMotion<3> >& sol) const
{
using namespace Dune;
double energy = 0;
const typename GridType::Traits::LeafIndexSet& indexSet = grid_->leafIndexSet();
if (sol.size()!=indexSet.size(gridDim))
DUNE_THROW(Exception, "Solution vector doesn't match the grid!");
std::vector<RigidBodyMotion<3> > localSolution(2);
ElementLeafIterator it = grid_->template leafbegin<0>();
ElementLeafIterator endIt = grid_->template leafend<0>();
// Loop over all elements
for (; it!=endIt; ++it) {
for (int i=0; i<2; i++)
localSolution[i] = sol[indexSet.subIndex(*it,i,gridDim)];
energy += this->localStiffness_->energy(*it, localSolution);
}
double energy = GeodesicFEAssembler<typename GridType::LeafGridView,RigidBodyMotion<3> >::computeEnergy(sol);
return energy;
}
......
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