diff --git a/dune/solvers/solvers/quadraticipopt.hh b/dune/solvers/solvers/quadraticipopt.hh index 301bbc4c141b048dacc83eb5d358c37f156269eb..6dd96e707b335190601cb450683a8826df210b5f 100644 --- a/dune/solvers/solvers/quadraticipopt.hh +++ b/dune/solvers/solvers/quadraticipopt.hh @@ -21,6 +21,7 @@ #include <dune/solvers/common/boxconstraint.hh> #include <dune/solvers/common/canignore.hh> +#include <dune/solvers/common/wrapownshare.hh> #include <dune/solvers/solvers/linearsolver.hh> #include "IpTNLP.hpp" @@ -697,6 +698,12 @@ public: constraintObstacles_ = Dune::stackobject_to_shared_ptr(obstacles); } + //! Set box-constraints for the coordinates + template <class ObstacleVector> + void setObstacles(ObstacleVector&& obstacles) { + obstacles_ = wrap_own_share<std::vector<BoxConstraint<field_type, blocksize> > >(std::forward<ObstacleVector>(obstacles)); + } + virtual void solve(); /////////////////////////////////////////////////////// @@ -720,7 +727,7 @@ public: //! Vector containing the bound constraints of the variables // Can stay unset when no bound constraints exist - std::vector<BoxConstraint<field_type,blocksize> >* obstacles_; + std::shared_ptr<std::vector<BoxConstraint<field_type,blocksize> > > obstacles_; //! The type of the linear solver to be used within IpOpt, default depends on the system where IpOpt is built std::string linearSolverType_;