16 using PolyFunc = xyz::polymorphic<StageFunctionTpl<Scalar>>;
17 using PolySet = xyz::polymorphic<ConstraintSetTpl<Scalar>>;
30 template <
typename Cstr> ALIGATOR_DEPRECATED
void pushBack(Cstr &&el) {
31 assert(!el.func.valueless_after_move() &&
32 "constraint must have non-null underlying function.");
33 assert(!el.set.valueless_after_move() &&
34 "constraint must have non-null underlying set.");
35 funcs.emplace_back(el.func);
36 sets.emplace_back(el.set);
41 assert(!func.valueless_after_move() &&
42 "constraint must have non-null underlying function.");
43 assert(!cstr_set.valueless_after_move() &&
44 "constraint must have non-null underlying set.");
45 funcs.emplace_back(func);
46 sets.emplace_back(cstr_set);
51 const std::vector<long> &
dims()
const {
return dims_; }
57 return dynamic_cast<Derived *
>(&*
funcs[id]);
61 template <
typename Derived>
63 return dynamic_cast<const Derived *
>(&*
funcs[id]);
75 void addDim(
const long nr) {
76 const long last_cursor =
indices_.back();
77 indices_.push_back(last_cursor + nr);
91#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
Base definitions for ternary functions.
Convenience class to manage a stack of constraints.
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