diff --git a/gtsam/hybrid/HybridBayesNet.h b/gtsam/hybrid/HybridBayesNet.h index 4e411b781..43eead280 100644 --- a/gtsam/hybrid/HybridBayesNet.h +++ b/gtsam/hybrid/HybridBayesNet.h @@ -35,7 +35,7 @@ class GTSAM_EXPORT HybridBayesNet : public BayesNet { using sharedConditional = boost::shared_ptr; /** Construct empty bayes net */ - HybridBayesNet() : Base() {} + HybridBayesNet() = default; }; } // namespace gtsam diff --git a/gtsam/hybrid/HybridBayesTree.cpp b/gtsam/hybrid/HybridBayesTree.cpp index 426202861..c8d70e67e 100644 --- a/gtsam/hybrid/HybridBayesTree.cpp +++ b/gtsam/hybrid/HybridBayesTree.cpp @@ -33,5 +33,4 @@ bool HybridBayesTree::equals(const This& other, double tol) const { return Base::equals(other, tol); } -/* **************************************************************************/ } // namespace gtsam diff --git a/gtsam/hybrid/HybridBayesTree.h b/gtsam/hybrid/HybridBayesTree.h index 74bd234d8..f8a90d6b4 100644 --- a/gtsam/hybrid/HybridBayesTree.h +++ b/gtsam/hybrid/HybridBayesTree.h @@ -70,7 +70,13 @@ class GTSAM_EXPORT HybridBayesTree : public BayesTree { /// @} }; -/* This does special stuff for the hybrid case */ +/** + * @brief Class for Hybrid Bayes tree orphan subtrees. + * + * This does special stuff for the hybrid case + * + * @tparam CLIQUE + */ template class BayesTreeOrphanWrapper< CLIQUE, typename std::enable_if< @@ -82,16 +88,22 @@ class BayesTreeOrphanWrapper< boost::shared_ptr clique; + /** + * @brief Construct a new Bayes Tree Orphan Wrapper object. + * + * @param clique Bayes tree clique. + */ BayesTreeOrphanWrapper(const boost::shared_ptr& clique) : clique(clique) { // Store parent keys in our base type factor so that eliminating those // parent keys will pull this subtree into the elimination. this->keys_.assign(clique->conditional()->beginParents(), clique->conditional()->endParents()); - this->discreteKeys_.assign(clique->conditional()->discreteKeys_.begin(), - clique->conditional()->discreteKeys_.end()); + this->discreteKeys_.assign(clique->conditional()->discreteKeys().begin(), + clique->conditional()->discreteKeys().end()); } + /// print utility void print( const std::string& s = "", const KeyFormatter& formatter = DefaultKeyFormatter) const override { diff --git a/gtsam/hybrid/HybridEliminationTree.h b/gtsam/hybrid/HybridEliminationTree.h index 902beb279..27766724a 100644 --- a/gtsam/hybrid/HybridEliminationTree.h +++ b/gtsam/hybrid/HybridEliminationTree.h @@ -28,12 +28,18 @@ namespace gtsam { */ class GTSAM_EXPORT HybridEliminationTree : public EliminationTree { + private: + friend class ::EliminationTreeTester; + public: typedef EliminationTree Base; ///< Base class typedef HybridEliminationTree This; ///< This class typedef boost::shared_ptr shared_ptr; ///< Shared pointer to this class + /// @name Constructors + /// @{ + /** * Build the elimination tree of a factor graph using pre-computed column * structure. @@ -54,11 +60,10 @@ class GTSAM_EXPORT HybridEliminationTree HybridEliminationTree(const HybridFactorGraph& factorGraph, const Ordering& order); + /// @} + /** Test whether the tree is equal to another */ bool equals(const This& other, double tol = 1e-9) const; - - private: - friend class ::EliminationTreeTester; }; } // namespace gtsam diff --git a/gtsam/hybrid/HybridFactorGraph.cpp b/gtsam/hybrid/HybridFactorGraph.cpp index 954ee57a6..450636ab3 100644 --- a/gtsam/hybrid/HybridFactorGraph.cpp +++ b/gtsam/hybrid/HybridFactorGraph.cpp @@ -150,8 +150,8 @@ EliminateHybrid(const HybridFactorGraph &factors, const Ordering &frontalKeys) { std::cout << RESET; } separatorKeys.insert(factor->begin(), factor->end()); - if (!factor->isContinuous_) { - for (auto &k : factor->discreteKeys_) { + if (!factor->isContinuous()) { + for (auto &k : factor->discreteKeys()) { mapFromKeyToDiscreteKey[k.first] = k; } } @@ -223,9 +223,9 @@ EliminateHybrid(const HybridFactorGraph &factors, const Ordering &frontalKeys) { for (auto &fp : factors) { auto ptr = boost::dynamic_pointer_cast(fp); if (ptr) { - gfg.push_back(ptr->inner); + gfg.push_back(ptr->inner()); } else { - auto p = boost::static_pointer_cast(fp)->inner; + auto p = boost::static_pointer_cast(fp)->inner(); if (p) { gfg.push_back(boost::static_pointer_cast(p)); } else { @@ -251,9 +251,9 @@ EliminateHybrid(const HybridFactorGraph &factors, const Ordering &frontalKeys) { for (auto &fp : factors) { auto ptr = boost::dynamic_pointer_cast(fp); if (ptr) { - dfg.push_back(ptr->inner); + dfg.push_back(ptr->inner()); } else { - auto p = boost::static_pointer_cast(fp)->inner; + auto p = boost::static_pointer_cast(fp)->inner(); if (p) { dfg.push_back(boost::static_pointer_cast(p)); } else { @@ -288,7 +288,7 @@ EliminateHybrid(const HybridFactorGraph &factors, const Ordering &frontalKeys) { std::vector deferredFactors; for (auto &f : factors) { - if (f->isHybrid_) { + if (f->isHybrid()) { auto cgmf = boost::dynamic_pointer_cast(f); if (cgmf) { sum = cgmf->add(sum); @@ -299,9 +299,9 @@ EliminateHybrid(const HybridFactorGraph &factors, const Ordering &frontalKeys) { sum = gm->asMixture()->add(sum); } - } else if (f->isContinuous_) { + } else if (f->isContinuous()) { deferredFactors.push_back( - boost::dynamic_pointer_cast(f)->inner); + boost::dynamic_pointer_cast(f)->inner()); } else { // We need to handle the case where the object is actually an // BayesTreeOrphanWrapper! diff --git a/gtsam/hybrid/HybridISAM.cpp b/gtsam/hybrid/HybridISAM.cpp index 0db30f1f3..f743b92f1 100644 --- a/gtsam/hybrid/HybridISAM.cpp +++ b/gtsam/hybrid/HybridISAM.cpp @@ -58,7 +58,7 @@ void HybridISAM::updateInternal(const HybridFactorGraph& newFactors, KeySet allDiscrete; for (auto& factor : factors) { - for (auto& k : factor->discreteKeys_) { + for (auto& k : factor->discreteKeys()) { allDiscrete.insert(k.first); } } diff --git a/gtsam/hybrid/HybridJunctionTree.cpp b/gtsam/hybrid/HybridJunctionTree.cpp index bf088c5aa..d1e19f852 100644 --- a/gtsam/hybrid/HybridJunctionTree.cpp +++ b/gtsam/hybrid/HybridJunctionTree.cpp @@ -63,7 +63,7 @@ struct HybridConstructorTraversalData { std::cout << "Getting discrete info: "; #endif for (HybridFactor::shared_ptr& f : node->factors) { - for (auto& k : f->discreteKeys_) { + for (auto& k : f->discreteKeys()) { #ifdef GTSAM_HYBRID_JUNCTIONTREE_DEBUG std::cout << "DK: " << DefaultKeyFormatter(k.first) << "\n"; #endif