Skip to content
Snippets Groups Projects
Commit 4241680a authored by Jonathan Youett's avatar Jonathan Youett
Browse files

Minor cleanup

parent e8570c8e
No related branches found
No related tags found
No related merge requests found
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set ts=4 sw=2 et sts=2: // vi: set ts=4 sw=2 et sts=2:
#include <memory>
#include <dune/fufem/assemblers/functionalassembler.hh> #include <dune/fufem/assemblers/functionalassembler.hh>
#include <dune/fufem/assemblers/operatorassembler.hh> #include <dune/fufem/assemblers/operatorassembler.hh>
...@@ -17,15 +16,15 @@ typename VectorType::field_type StaticMgContactProblem<VectorType,MaterialType>: ...@@ -17,15 +16,15 @@ typename VectorType::field_type StaticMgContactProblem<VectorType,MaterialType>:
deformGrids(iterates); deformGrids(iterates);
// The infeasibility is the maximal nonlinear constraint violation // 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++) { 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 // rebuild coupling and evaluate obstacles
auto obstacles = coupling->assembleObstacles(true); auto obstacles = coupling->assembleObstacles(true);
for (size_t j=0; j<obstacles.size(); j++) for (const auto& obstacle : obstacles)
infeasibility = std::max(infeasibility, -obstacles[j]); infeasibility = std::max(infeasibility, -obstacle);
} }
return infeasibility; return infeasibility;
...@@ -59,7 +58,7 @@ template <class VectorType, class MaterialType> ...@@ -59,7 +58,7 @@ template <class VectorType, class MaterialType>
void StaticMgContactProblem<VectorType,MaterialType>::assembleQP(const std::vector<VectorType>& iterates) void StaticMgContactProblem<VectorType,MaterialType>::assembleQP(const std::vector<VectorType>& iterates)
{ {
// assemble linear and quadratic terms // 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]; auto& material = (*this->materials_)[i];
const auto& basis = material.basis(); const auto& basis = material.basis();
...@@ -90,8 +89,6 @@ void StaticMgContactProblem<VectorType,MaterialType>::assembleQP(const std::vect ...@@ -90,8 +89,6 @@ void StaticMgContactProblem<VectorType,MaterialType>::assembleQP(const std::vect
// assemble the linearisations // assemble the linearisations
contactAssembler_->assembleLinearisations(); contactAssembler_->assembleLinearisations();
// assemble the local coordinate systems and obstacles
contactAssembler_->assembleClpReflections(); contactAssembler_->assembleClpReflections();
contactAssembler_->assembleObstacle(); contactAssembler_->assembleObstacle();
......
...@@ -78,7 +78,7 @@ public: ...@@ -78,7 +78,7 @@ public:
const std::vector<VectorType>& rhs() const {return rhs_;} const std::vector<VectorType>& rhs() const {return rhs_;}
//! Return the nonlinear constraints //! Return the nonlinear constraints
const std::vector<BoxConstraint<field_type, dim> >& constraints() const const auto& constraints() const
{ {
return contactAssembler_->totalObstacles_; return contactAssembler_->totalObstacles_;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment