Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fwd.hpp] add deprecations for uses of Eigen::aligned_allocator #184

Merged
merged 4 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/macos-linux-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'CHANGELOG.md'
- 'CITATION.cff'
- 'CITATIONS.bib'
pull_request:
Expand All @@ -17,6 +18,7 @@ on:
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'CHANGELOG.md'
- 'CITATION.cff'
- 'CITATIONS.bib'

Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Use placement-new for `Workspace` and `Results` in solvers (FDDP and ProxDDP)
- Deprecate typedef for `std::vector<T, Eigen::aligned_allocator<T>>`
- Deprecate function template `allocate_shared_eigen_aligned<T>`

### Fixed

Expand Down
13 changes: 10 additions & 3 deletions include/aligator/fwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,19 @@ template <typename Scalar> struct ResultsTpl;
template <typename Scalar> struct FilterTpl;

template <typename T>
using StdVectorEigenAligned = std::vector<T, Eigen::aligned_allocator<T>>;
using StdVectorEigenAligned ALIGATOR_DEPRECATED_MESSAGE(
"Aligator now requires C++17 and the Eigen::aligned_allocator<T> class is "
"no longer useful. Please use std::vector<T> instead, this typedef will "
"change to be an alias of that of the future, then will be removed.") =
std::vector<T, Eigen::aligned_allocator<T>>;

template <typename T, typename... Args>
ALIGATOR_DEPRECATED_MESSAGE(
"Aligator now requires C++17 and the Eigen::aligned_allocator<T> class is "
"no longer useful. This function is now just an alias for "
"std::make_shared, and will be removed in the future.")
inline auto allocate_shared_eigen_aligned(Args &&...args) {
return std::allocate_shared<T>(Eigen::aligned_allocator<T>(),
std::forward<Args>(args)...);
return std::make_shared<T>(std::forward<Args>(args)...);
}

} // namespace aligator
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct AngularAccelerationResidualTpl : StageFunctionTpl<_Scalar> {
const ConstVectorRef &, BaseData &data) const;

shared_ptr<BaseData> createData() const {
return allocate_shared_eigen_aligned<Data>(this);
return std::make_shared<Data>(this);
}

ContactMap contact_map_;
Expand Down
2 changes: 1 addition & 1 deletion include/aligator/modelling/centroidal/angular-momentum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct AngularMomentumResidualTpl : UnaryFunctionTpl<_Scalar> {
void computeJacobians(const ConstVectorRef &, BaseData &data) const;

shared_ptr<BaseData> createData() const {
return allocate_shared_eigen_aligned<Data>(this);
return std::make_shared<Data>(this);
}

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct CentroidalAccelerationResidualTpl : StageFunctionTpl<_Scalar> {
const ConstVectorRef &, BaseData &data) const;

shared_ptr<BaseData> createData() const {
return allocate_shared_eigen_aligned<Data>(this);
return std::make_shared<Data>(this);
}

ContactMap contact_map_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct CentroidalCoMResidualTpl : UnaryFunctionTpl<_Scalar> {
void computeJacobians(const ConstVectorRef &, BaseData &data) const;

shared_ptr<BaseData> createData() const {
return allocate_shared_eigen_aligned<Data>(this);
return std::make_shared<Data>(this);
}

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct CentroidalWrapperResidualTpl : UnaryFunctionTpl<_Scalar> {
void computeJacobians(const ConstVectorRef &x, BaseData &data) const;

shared_ptr<BaseData> createData() const {
return allocate_shared_eigen_aligned<Data>(this);
return std::make_shared<Data>(this);
}

FunPtr centroidal_cost_;
Expand Down
2 changes: 1 addition & 1 deletion include/aligator/modelling/centroidal/friction-cone.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct FrictionConeResidualTpl : StageFunctionTpl<_Scalar> {
const ConstVectorRef &, BaseData &data) const;

shared_ptr<BaseData> createData() const {
return allocate_shared_eigen_aligned<Data>(this);
return std::make_shared<Data>(this);
}

protected:
Expand Down
2 changes: 1 addition & 1 deletion include/aligator/modelling/centroidal/linear-momentum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct LinearMomentumResidualTpl : UnaryFunctionTpl<_Scalar> {
void computeJacobians(const ConstVectorRef &, BaseData &data) const;

shared_ptr<BaseData> createData() const {
return allocate_shared_eigen_aligned<Data>(this);
return std::make_shared<Data>(this);
}

protected:
Expand Down
2 changes: 1 addition & 1 deletion include/aligator/modelling/centroidal/wrench-cone.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct WrenchConeResidualTpl : StageFunctionTpl<_Scalar> {
const ConstVectorRef &, BaseData &data) const;

shared_ptr<BaseData> createData() const {
return allocate_shared_eigen_aligned<Data>(this);
return std::make_shared<Data>(this);
}

protected:
Expand Down
2 changes: 1 addition & 1 deletion include/aligator/modelling/dynamics/centroidal-fwd.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void CentroidalFwdDynamicsTpl<Scalar>::dForward(const ConstVectorRef &x,
template <typename Scalar>
shared_ptr<ContinuousDynamicsDataTpl<Scalar>>
CentroidalFwdDynamicsTpl<Scalar>::createData() const {
return allocate_shared_eigen_aligned<Data>(this);
return std::make_shared<Data>(this);
}

template <typename Scalar>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void ContinuousCentroidalFwdDynamicsTpl<Scalar>::dForward(
template <typename Scalar>
shared_ptr<ContinuousDynamicsDataTpl<Scalar>>
ContinuousCentroidalFwdDynamicsTpl<Scalar>::createData() const {
return allocate_shared_eigen_aligned<Data>(this);
return std::make_shared<Data>(this);
}

template <typename Scalar>
Expand Down
2 changes: 1 addition & 1 deletion include/aligator/modelling/dynamics/kinodynamics-fwd.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ void KinodynamicsFwdDynamicsTpl<Scalar>::dForward(const ConstVectorRef &x,
template <typename Scalar>
shared_ptr<ContinuousDynamicsDataTpl<Scalar>>
KinodynamicsFwdDynamicsTpl<Scalar>::createData() const {
return allocate_shared_eigen_aligned<Data>(this);
return std::make_shared<Data>(this);
}

template <typename Scalar>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void MultibodyConstraintFwdDynamicsTpl<Scalar>::dForward(const ConstVectorRef &,
template <typename Scalar>
shared_ptr<ContinuousDynamicsDataTpl<Scalar>>
MultibodyConstraintFwdDynamicsTpl<Scalar>::createData() const {
return allocate_shared_eigen_aligned<Data>(*this);
return std::make_shared<Data>(*this);
}

template <typename Scalar>
Expand Down
2 changes: 1 addition & 1 deletion include/aligator/modelling/dynamics/multibody-free-fwd.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void MultibodyFreeFwdDynamicsTpl<Scalar>::dForward(const ConstVectorRef &x,
template <typename Scalar>
shared_ptr<ContinuousDynamicsDataTpl<Scalar>>
MultibodyFreeFwdDynamicsTpl<Scalar>::createData() const {
return allocate_shared_eigen_aligned<Data>(this);
return std::make_shared<Data>(this);
}

template <typename Scalar>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct CenterOfMassTranslationResidualTpl : UnaryFunctionTpl<_Scalar>,
void computeJacobians(const ConstVectorRef &x, BaseData &data) const;

shared_ptr<BaseData> createData() const {
return allocate_shared_eigen_aligned<Data>(this);
return std::make_shared<Data>(this);
}

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct CenterOfMassVelocityResidualTpl : UnaryFunctionTpl<_Scalar>, frame_api {
void computeJacobians(const ConstVectorRef &x, BaseData &data) const;

shared_ptr<BaseData> createData() const {
return allocate_shared_eigen_aligned<Data>(*this);
return std::make_shared<Data>(*this);
}

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct CentroidalMomentumDerivativeResidualTpl : StageFunctionTpl<_Scalar>,
const ConstVectorRef &, BaseData &data) const;

shared_ptr<BaseData> createData() const {
return allocate_shared_eigen_aligned<Data>(this);
return std::make_shared<Data>(this);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct CentroidalMomentumResidualTpl : UnaryFunctionTpl<_Scalar>, frame_api {
void setReference(const Eigen::Ref<const Vector6s> &h_new) { h_ref_ = h_new; }

shared_ptr<BaseData> createData() const {
return allocate_shared_eigen_aligned<Data>(this);
return std::make_shared<Data>(this);
}
};

Expand Down
2 changes: 1 addition & 1 deletion include/aligator/modelling/multibody/contact-force.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct ContactForceResidualTpl : StageFunctionTpl<_Scalar>, frame_api {
const ConstVectorRef &, BaseData &data) const;

shared_ptr<BaseData> createData() const {
return allocate_shared_eigen_aligned<Data>(this);
return std::make_shared<Data>(this);
}
};

Expand Down
2 changes: 1 addition & 1 deletion include/aligator/modelling/multibody/fly-high.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct FlyHighResidualTpl : UnaryFunctionTpl<_Scalar>, frame_api {
void computeJacobians(const ConstVectorRef &x, BaseData &data) const;

shared_ptr<BaseData> createData() const {
return allocate_shared_eigen_aligned<Data>(*this);
return std::make_shared<Data>(*this);
}

const auto &getModel() const { return pmodel_; }
Expand Down
2 changes: 1 addition & 1 deletion include/aligator/modelling/multibody/frame-placement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct FramePlacementResidualTpl : UnaryFunctionTpl<_Scalar>, frame_api {
void computeJacobians(const ConstVectorRef &x, BaseData &data) const;

shared_ptr<BaseData> createData() const {
return allocate_shared_eigen_aligned<Data>(*this);
return std::make_shared<Data>(*this);
}

protected:
Expand Down
2 changes: 1 addition & 1 deletion include/aligator/modelling/multibody/frame-translation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct FrameTranslationResidualTpl : UnaryFunctionTpl<_Scalar>, frame_api {
void computeJacobians(const ConstVectorRef &x, BaseData &data) const;

shared_ptr<BaseData> createData() const {
return allocate_shared_eigen_aligned<Data>(*this);
return std::make_shared<Data>(*this);
}

protected:
Expand Down
2 changes: 1 addition & 1 deletion include/aligator/modelling/multibody/frame-velocity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct FrameVelocityResidualTpl : UnaryFunctionTpl<_Scalar>, frame_api {
void computeJacobians(const ConstVectorRef &x, BaseData &data) const;

shared_ptr<BaseData> createData() const {
return allocate_shared_eigen_aligned<Data>(*this);
return std::make_shared<Data>(*this);
}

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ struct MultibodyWrenchConeResidualTpl : StageFunctionTpl<_Scalar>, frame_api {
const ConstVectorRef &, BaseData &data) const;

shared_ptr<BaseData> createData() const {
return allocate_shared_eigen_aligned<Data>(this);
return std::make_shared<Data>(this);
}
};

Expand Down
Loading