From b2bd9d116aac921321f5b0dbb987e90b49ebdc5a Mon Sep 17 00:00:00 2001 From: Jonathan Youett <youett@math.fu-berlin.de> Date: Wed, 10 Oct 2018 09:52:28 +0200 Subject: [PATCH] Use ranged-based for-loop --- dune/elasticity/materials/adolcmaterial.hh | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/dune/elasticity/materials/adolcmaterial.hh b/dune/elasticity/materials/adolcmaterial.hh index 596325c..5f12724 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; -- GitLab