Updated print functions

release/4.3a0
Richard Roberts 2013-07-26 01:10:12 +00:00
parent 6b1e1d16d5
commit 0b13c437fe
3 changed files with 27 additions and 2 deletions

View File

@ -68,9 +68,9 @@ namespace gtsam {
std::cout << str << "(" << keyFormatter(key) << ")\n"; std::cout << str << "(" << keyFormatter(key) << ")\n";
BOOST_FOREACH(const sharedFactor& factor, factors) { BOOST_FOREACH(const sharedFactor& factor, factors) {
if(factor) if(factor)
factor->print(str + "| "); factor->print(str);
else else
std::cout << str << "| null factor\n"; std::cout << str << "null factor\n";
} }
} }

View File

@ -189,6 +189,25 @@ namespace gtsam {
} }
} }
/* ************************************************************************* */
template<class BAYESTREE, class GRAPH>
void JunctionTreeUnordered<BAYESTREE,GRAPH>::Node::print(
const std::string& s, const KeyFormatter& keyFormatter) const
{
std::cout << s;
BOOST_FOREACH(Key j, keys)
std::cout << j << " ";
std::cout << "problemSize = " << problemSize_ << std::endl;
}
/* ************************************************************************* */
template<class BAYESTREE, class GRAPH>
void JunctionTreeUnordered<BAYESTREE,GRAPH>::print(
const std::string& s = "", const KeyFormatter& keyFormatter = DefaultKeyFormatter) const
{
treeTraversal::PrintForest(*this, s, keyFormatter);
}
/* ************************************************************************* */ /* ************************************************************************* */
template<class BAYESTREE, class GRAPH> template<class BAYESTREE, class GRAPH>
template<class ETREE> template<class ETREE>

View File

@ -68,6 +68,9 @@ namespace gtsam {
Keys keys; ///< Frontal keys of this node Keys keys; ///< Frontal keys of this node
Factors factors; ///< Factors associated with this node Factors factors; ///< Factors associated with this node
Children children; ///< sub-trees Children children; ///< sub-trees
/** print this node */
void print(const std::string& s = "", const KeyFormatter& keyFormatter = DefaultKeyFormatter) const;
}; };
typedef boost::shared_ptr<Node> sharedNode; ///< Shared pointer to Node typedef boost::shared_ptr<Node> sharedNode; ///< Shared pointer to Node
@ -112,6 +115,9 @@ namespace gtsam {
std::pair<boost::shared_ptr<BayesTreeType>, boost::shared_ptr<FactorGraphType> > std::pair<boost::shared_ptr<BayesTreeType>, boost::shared_ptr<FactorGraphType> >
eliminate(const Eliminate& function) const; eliminate(const Eliminate& function) const;
/** Print the junction tree */
void print(const std::string& s = "", const KeyFormatter& keyFormatter = DefaultKeyFormatter) const;
/// @} /// @}
/// @name Advanced Interface /// @name Advanced Interface