11 #ifndef HPP_FCL_SERIALIZATION_EIGEN_H 12 #define HPP_FCL_SERIALIZATION_EIGEN_H 14 #include <Eigen/Dense> 16 #include <boost/serialization/split_free.hpp> 17 #include <boost/serialization/vector.hpp> 18 #include <boost/serialization/array.hpp> 23 #if __GNUC__ >= 7 && __cplusplus >= 201703L 25 namespace serialization {
41 namespace serialization {
43 #ifndef HPP_FCL_SKIP_EIGEN_BOOST_SERIALIZATION 45 template <
class Archive,
typename Scalar,
int Rows,
int Cols,
int Options,
46 int MaxRows,
int MaxCols>
48 const Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>&
m,
49 const unsigned int ) {
50 Eigen::DenseIndex
rows(m.rows()),
cols(m.cols());
51 if (Rows == Eigen::Dynamic) ar& BOOST_SERIALIZATION_NVP(
rows);
52 if (Cols == Eigen::Dynamic) ar& BOOST_SERIALIZATION_NVP(
cols);
53 ar& make_nvp(
"data", make_array(m.data(), (size_t)m.size()));
56 template <
class Archive,
typename Scalar,
int Rows,
int Cols,
int Options,
57 int MaxRows,
int MaxCols>
59 Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>&
m,
60 const unsigned int ) {
61 Eigen::DenseIndex
rows = Rows,
cols = Cols;
62 if (Rows == Eigen::Dynamic) ar >> BOOST_SERIALIZATION_NVP(rows);
63 if (Cols == Eigen::Dynamic) ar >> BOOST_SERIALIZATION_NVP(cols);
65 ar >> make_nvp(
"data", make_array(m.data(), (size_t)m.size()));
68 template <
class Archive,
typename Scalar,
int Rows,
int Cols,
int Options,
69 int MaxRows,
int MaxCols>
71 Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>&
m,
72 const unsigned int version) {
73 split_free(ar, m, version);
76 template <
class Archive,
typename PlainObjectBase,
int MapOptions,
79 const Eigen::Map<PlainObjectBase, MapOptions, StrideType>&
m,
80 const unsigned int ) {
81 Eigen::DenseIndex
rows(m.rows()),
cols(m.cols());
82 if (PlainObjectBase::RowsAtCompileTime == Eigen::Dynamic)
83 ar& BOOST_SERIALIZATION_NVP(
rows);
84 if (PlainObjectBase::ColsAtCompileTime == Eigen::Dynamic)
85 ar& BOOST_SERIALIZATION_NVP(
cols);
86 ar& make_nvp(
"data", make_array(m.data(), (size_t)m.size()));
89 template <
class Archive,
typename PlainObjectBase,
int MapOptions,
91 void load(Archive& ar, Eigen::Map<PlainObjectBase, MapOptions, StrideType>&
m,
92 const unsigned int ) {
93 Eigen::DenseIndex
rows = PlainObjectBase::RowsAtCompileTime,
94 cols = PlainObjectBase::ColsAtCompileTime;
95 if (PlainObjectBase::RowsAtCompileTime == Eigen::Dynamic)
96 ar >> BOOST_SERIALIZATION_NVP(rows);
97 if (PlainObjectBase::ColsAtCompileTime == Eigen::Dynamic)
98 ar >> BOOST_SERIALIZATION_NVP(cols);
100 ar >> make_nvp(
"data", make_array(m.data(), (size_t)m.size()));
103 template <
class Archive,
typename PlainObjectBase,
int MapOptions,
106 Eigen::Map<PlainObjectBase, MapOptions, StrideType>&
m,
107 const unsigned int version) {
108 split_free(ar, m, version);
111 #endif // ifned HPP_FCL_SKIP_EIGEN_BOOST_SERIALIZATION 115 #endif // ifndef HPP_FCL_SERIALIZATION_EIGEN_H
void serialize(Archive &ar, hpp::fcl::AABB &aabb, const unsigned int)
void save(Archive &ar, const hpp::fcl::BVSplitter< BV > &splitter_, const unsigned int)
void load(Archive &ar, hpp::fcl::BVSplitter< BV > &splitter_, const unsigned int)