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

Add setter for obstacle field, and store it internally as shared_ptr

parent 16976ae7
Branches
Tags
No related merge requests found
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <dune/solvers/common/boxconstraint.hh> #include <dune/solvers/common/boxconstraint.hh>
#include <dune/solvers/common/canignore.hh> #include <dune/solvers/common/canignore.hh>
#include <dune/solvers/common/wrapownshare.hh>
#include <dune/solvers/solvers/linearsolver.hh> #include <dune/solvers/solvers/linearsolver.hh>
#include "IpTNLP.hpp" #include "IpTNLP.hpp"
...@@ -697,6 +698,12 @@ public: ...@@ -697,6 +698,12 @@ public:
constraintObstacles_ = Dune::stackobject_to_shared_ptr(obstacles); 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(); virtual void solve();
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
...@@ -720,7 +727,7 @@ public: ...@@ -720,7 +727,7 @@ public:
//! Vector containing the bound constraints of the variables //! Vector containing the bound constraints of the variables
// Can stay unset when no bound constraints exist // 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 //! The type of the linear solver to be used within IpOpt, default depends on the system where IpOpt is built
std::string linearSolverType_; std::string linearSolverType_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment