Skip to content

Commit

Permalink
Fix serialization of ISAM2 class
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottMcMichael committed Jul 9, 2021
1 parent cd3854a commit df579ec
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
10 changes: 10 additions & 0 deletions gtsam/inference/VariableIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,16 @@ class GTSAM_EXPORT VariableIndex {
return item->second;
}

private:
/** Serialization function */
friend class boost::serialization::access;
template<class ARCHIVE>
void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
ar & BOOST_SERIALIZATION_NVP(index_);
ar & BOOST_SERIALIZATION_NVP(nFactors_);
ar & BOOST_SERIALIZATION_NVP(nEntries_);
}

/// @}
};

Expand Down
20 changes: 20 additions & 0 deletions gtsam/nonlinear/ISAM2.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,26 @@ class GTSAM_EXPORT ISAM2 : public BayesTree<ISAM2Clique> {
void removeVariables(const KeySet& unusedKeys);

void updateDelta(bool forceFullSolve = false) const;

private:
/** Serialization function */
friend class boost::serialization::access;
template<class ARCHIVE>
void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
ar & boost::serialization::base_object<BayesTree<ISAM2Clique> >(*this);
ar & BOOST_SERIALIZATION_NVP(theta_);
ar & BOOST_SERIALIZATION_NVP(variableIndex_);
ar & BOOST_SERIALIZATION_NVP(delta_);
ar & BOOST_SERIALIZATION_NVP(deltaNewton_);
ar & BOOST_SERIALIZATION_NVP(RgProd_);
ar & BOOST_SERIALIZATION_NVP(deltaReplacedMask_);
ar & BOOST_SERIALIZATION_NVP(nonlinearFactors_);
ar & BOOST_SERIALIZATION_NVP(linearFactors_);
ar & BOOST_SERIALIZATION_NVP(doglegDelta_);
ar & BOOST_SERIALIZATION_NVP(fixedVariables_);
ar & BOOST_SERIALIZATION_NVP(update_count_);
}

}; // ISAM2

/// traits
Expand Down

0 comments on commit df579ec

Please sign in to comment.