diff --git a/dune/contact/common/staticmgcontactproblem.cc b/dune/contact/common/staticmgcontactproblem.cc index 8eaf819b59fdb9a0ce8784a838a32c9c7d79e25f..67724021af20db5c0f3d4e3345a6794d779adae5 100644 --- a/dune/contact/common/staticmgcontactproblem.cc +++ b/dune/contact/common/staticmgcontactproblem.cc @@ -1,7 +1,6 @@ // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- // vi: set ts=4 sw=2 et sts=2: -#include <memory> #include <dune/fufem/assemblers/functionalassembler.hh> #include <dune/fufem/assemblers/operatorassembler.hh> @@ -17,15 +16,15 @@ typename VectorType::field_type StaticMgContactProblem<VectorType,MaterialType>: deformGrids(iterates); // The infeasibility is the maximal nonlinear constraint violation - field_type infeasibility(0); + field_type infeasibility{0.0}; for (int i=0; i<contactAssembler_->nCouplings(); i++) { - auto* coupling = dynamic_cast<ContactCoupling*>(contactAssembler_->getContactCouplings()[i].get()); + auto coupling = std::dynamic_pointer_cast<ContactCoupling>(contactAssembler_->getContactCouplings()[i]); // rebuild coupling and evaluate obstacles auto obstacles = coupling->assembleObstacles(true); - for (size_t j=0; j<obstacles.size(); j++) - infeasibility = std::max(infeasibility, -obstacles[j]); + for (const auto& obstacle : obstacles) + infeasibility = std::max(infeasibility, -obstacle); } return infeasibility; @@ -59,7 +58,7 @@ template <class VectorType, class MaterialType> void StaticMgContactProblem<VectorType,MaterialType>::assembleQP(const std::vector<VectorType>& iterates) { // assemble linear and quadratic terms - for (size_t i=0;i<iterates.size();i++) { + for (size_t i=0 ; i < iterates.size(); i++) { auto& material = (*this->materials_)[i]; const auto& basis = material.basis(); @@ -90,8 +89,6 @@ void StaticMgContactProblem<VectorType,MaterialType>::assembleQP(const std::vect // assemble the linearisations contactAssembler_->assembleLinearisations(); - - // assemble the local coordinate systems and obstacles contactAssembler_->assembleClpReflections(); contactAssembler_->assembleObstacle(); diff --git a/dune/contact/common/staticmgcontactproblem.hh b/dune/contact/common/staticmgcontactproblem.hh index 2c295dea391c4b6f3faadd5b8f0d58b0b4ddccb6..1ef46bad7e1618bbd648fcc32c8ea130e866f4b3 100644 --- a/dune/contact/common/staticmgcontactproblem.hh +++ b/dune/contact/common/staticmgcontactproblem.hh @@ -78,7 +78,7 @@ public: const std::vector<VectorType>& rhs() const {return rhs_;} //! Return the nonlinear constraints - const std::vector<BoxConstraint<field_type, dim> >& constraints() const + const auto& constraints() const { return contactAssembler_->totalObstacles_; }