From 1b4b292a6ed21363882920f6b247174d7672dc42 Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Fri, 6 Dec 2019 14:08:04 -0500 Subject: [PATCH] Refine workaround --- gtsam/inference/BayesTreeCliqueBase.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gtsam/inference/BayesTreeCliqueBase.h b/gtsam/inference/BayesTreeCliqueBase.h index cd8157a26..6266e961c 100644 --- a/gtsam/inference/BayesTreeCliqueBase.h +++ b/gtsam/inference/BayesTreeCliqueBase.h @@ -86,6 +86,8 @@ namespace gtsam { FastVector children; int problemSize_; + bool is_root = false; + /// Fill the elimination result produced during elimination. Here this just stores the /// conditional and ignores the remaining factor, but this is overridden in ISAM2Clique /// to also cache the remaining factor. @@ -165,8 +167,12 @@ namespace gtsam { friend class boost::serialization::access; template void serialize(ARCHIVE & ar, const unsigned int /*version*/) { + if(!parent_.lock()) { + is_root = true; + } + ar & BOOST_SERIALIZATION_NVP(is_root); ar & BOOST_SERIALIZATION_NVP(conditional_); - if (parent_) { // TODO(fan): Workaround for boost/serialization #119 + if (!is_root) { // TODO(fan): Workaround for boost/serialization #119 ar & BOOST_SERIALIZATION_NVP(parent_); } ar & BOOST_SERIALIZATION_NVP(children);