diff --git a/dune/elasticity/materials/adolcmaterial.hh b/dune/elasticity/materials/adolcmaterial.hh index 596325c0e19ea3496d4ad31768dce63b99f04a3e..5f1272440f1b969271de3b5e82d76d7516a061bd 100644 --- a/dune/elasticity/materials/adolcmaterial.hh +++ b/dune/elasticity/materials/adolcmaterial.hh @@ -74,29 +74,24 @@ public: { typename LocalEnergy::ReturnType aEnergy(0.0); - const auto& gridView = this->basis().getGridView(); + for (const auto& e : elements(this->basis().getGridView())) { - auto eIt = gridView.template begin<0>(); - auto eEndIt = gridView.template end<0>(); - - for (; eIt != eEndIt; ++eIt) { - - const auto& lfe = this->basis().getLocalFiniteElement(*eIt); + const auto& lfe = this->basis().getLocalFiniteElement(e); // interpolate by local finite element to get the local coefficients typename LocalEnergy::CoefficientVectorType localCoeff(lfe.localBasis().size()); - LocalWrapper fiLocal(*displace,*eIt,0); + LocalWrapper fiLocal(*displace, e, 0); std::vector<typename LocalWrapper::RangeType> interpolationValues; - for (int i=0; i<dim; i++) { + for (int i=0; i < dim; i++) { fiLocal.setIndex(i); - lfe.localInterpolation().interpolate(fiLocal,interpolationValues); - for (size_t j=0; j<lfe.localBasis().size(); j++) + lfe.localInterpolation().interpolate(fiLocal, interpolationValues); + for (size_t j=0; j< lfe.localBasis().size(); j++) localCoeff[j][i] = interpolationValues[j]; } - aEnergy += localEnergy_->energy(*eIt,lfe, localCoeff); + aEnergy += localEnergy_->energy(e,lfe, localCoeff); } ReturnType energy;