本文整理汇总了C++中TopologyNode::setFossil方法的典型用法代码示例。如果您正苦于以下问题:C++ TopologyNode::setFossil方法的具体用法?C++ TopologyNode::setFossil怎么用?C++ TopologyNode::setFossil使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TopologyNode
的用法示例。
在下文中一共展示了TopologyNode::setFossil方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: simulateTree
void AbstractRootedTreeDistribution::simulateTree( void )
{
// the time tree object (topology & times)
Tree *psi = new Tree();
// internally we treat unrooted topologies the same as rooted
psi->setRooted( true );
// create the tip nodes
std::vector<TopologyNode*> nodes;
for (size_t i=0; i<num_taxa; ++i)
{
// create the i-th taxon
TopologyNode* node = new TopologyNode( taxa[i], i );
// set the age of this tip node
node->setAge( taxa[i].getAge() );
if (node->getAge() > 0)
{
node->setFossil(true);
}
// add the new node to the list
nodes.push_back( node );
}
double ra = root_age->getValue();
double present = ra;
// we need a sorted vector of constraints, starting with the smallest
std::vector<Clade> sorted_clades;
std::vector<Clade> constraints;
for (size_t i = 0; i < constraints.size(); ++i)
{
if (constraints[i].getAge() > ra)
{
throw RbException("Cannot simulate tree: clade constraints are older than the root age.");
}
// set the ages of each of the taxa in the constraint
for (size_t j = 0; j < constraints[i].size(); ++j)
{
for (size_t k = 0; k < num_taxa; k++)
{
if ( taxa[k].getName() == constraints[i].getTaxonName(j) )
{
constraints[i].setTaxonAge(j, taxa[k].getAge());
break;
}
}
}
if ( constraints[i].size() > 1 && constraints[i].size() < num_taxa )
{
sorted_clades.push_back( constraints[i] );
}
}
// create a clade that contains all species
Clade all_species = Clade(taxa);
all_species.setAge( ra );
sorted_clades.push_back(all_species);
// next sort the clades
std::sort(sorted_clades.begin(),sorted_clades.end());
// remove duplicates
std::vector<Clade> tmp;
tmp.push_back( sorted_clades[0] );
for (size_t i = 1; i < sorted_clades.size(); ++i)
{
Clade &a = tmp[tmp.size()-1];
Clade &b = sorted_clades[i];
if ( a.size() != b.size() )
{
tmp.push_back( sorted_clades[i] );
}
else
{
bool equal = true;
for (size_t j = 0; j < a.size(); ++j)
{
if ( a.getTaxon(j) != b.getTaxon(j) )
{
equal = false;
break;
}
}
if ( equal == false )
{
tmp.push_back( sorted_clades[i] );
}
//.........这里部分代码省略.........