37 template <
typename Cstr> ALIGATOR_DEPRECATED
void pushBack(Cstr &&el) {
38 assert(!el.func.valueless_after_move() &&
39 "constraint must have non-null underlying function.");
40 assert(!el.set.valueless_after_move() &&
41 "constraint must have non-null underlying set.");
42 funcs.emplace_back(el.func);
43 sets.emplace_back(el.set);
49 "constraint must have non-null underlying function.");
51 "constraint must have non-null underlying set.");
52 funcs.emplace_back(func);
53 sets.emplace_back(cstr_set);
58 const std::vector<long> &
dims()
const {
return dims_; }
64 return dynamic_cast<Derived *
>(&*
funcs[id]);
68 template <
typename Derived>
70 return dynamic_cast<const Derived *
>(&*
funcs[id]);
82 void addDim(
const long nr) {
83 const long last_cursor =
indices_.back();
84 indices_.push_back(last_cursor + nr);
100#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
101#include "aligator/core/constraint.txx"
bool valueless_after_move() const noexcept
Base definitions for ternary functions.
const std::vector< long > & dims() const
Get the set of dimensions for each constraint in the stack.
xyz::polymorphic< StageFunctionTpl< Scalar > > PolyFunc
ConstraintStackTpl & operator=(const ConstraintStackTpl &)=default
ConstraintStackTpl & operator=(ConstraintStackTpl &&)=default
std::vector< PolyFunc > funcs
std::vector< PolySet > sets
std::vector< long > indices_
ALIGATOR_DYNAMIC_TYPEDEFS(Scalar)
ALIGATOR_DEPRECATED void pushBack(Cstr &&el)
void pushBack(const PolyFunc &func, const PolySet &cstr_set)
ConstraintStackTpl(ConstraintStackTpl &&)=default
const Derived * getConstraint(const size_t id) const
Get constraint function, cast down to the specified type.
std::vector< long > dims_
ConstraintStackTpl(const ConstraintStackTpl &)=default
Derived * getConstraint(const size_t id)
Get constraint function, cast down to the specified type.
xyz::polymorphic< ConstraintSetTpl< Scalar > > PolySet
Simple struct holding together a function and set, to describe a constraint.
xyz::polymorphic< ConstraintSetTpl< Scalar > > set
xyz::polymorphic< StageFunctionTpl< Scalar > > func