本文整理汇总了C++中VertexList::splice方法的典型用法代码示例。如果您正苦于以下问题:C++ VertexList::splice方法的具体用法?C++ VertexList::splice怎么用?C++ VertexList::splice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VertexList
的用法示例。
在下文中一共展示了VertexList::splice方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: smallestEnclosingSphere
void smallestEnclosingSphere(SrPoint3D* sp,int nsp,VertexList& vertexList,const VertexIterator& end,SrSphere3D& sphere)
{
createSphere(sp, nsp,sphere);
if( nsp==4 )
return;
VertexIterator iterator = vertexList.begin();
for( ; end != iterator ; )
{
const SrPoint3D& p = *iterator;
if( isOut(p,sphere) )
{
sp[ nsp ] = p;
smallestEnclosingSphere( sp, nsp + 1 , vertexList , iterator , sphere);
vertexList.splice(vertexList.begin(),vertexList,iterator++ );
}
else
{
iterator++;
}
}
}
示例2: DoTopologicalSort
//.........这里部分代码省略.........
// Determine what Blocks caused the loop
typedef std::map< Vertex, int > VertexStrongComponentIndexMap;
VertexStrongComponentIndexMap vertexStrongComponentIndexMap;
boost::associative_property_map< VertexStrongComponentIndexMap > apmVertexStrongComponentIndexMap( vertexStrongComponentIndexMap );
strong_components( graph, apmVertexStrongComponentIndexMap );
typedef std::vector< Vertex > VertexVector;
typedef std::map< int, VertexVector > StrongComponentIndexVertexGroupMap;
StrongComponentIndexVertexGroupMap strongComponentIndexVertexGroupMap;
for( VertexStrongComponentIndexMap::iterator vsmItr = vertexStrongComponentIndexMap.begin(); vsmItr != vertexStrongComponentIndexMap.end(); ++vsmItr ) {
strongComponentIndexVertexGroupMap[ vsmItr->second ].push_back( vsmItr->first );
}
std::string error( "Dataflow Graph '" + static_cast< std::string >( subsystem.Name() ) + "' has unhandled loops: " );
for( StrongComponentIndexVertexGroupMap::iterator svmItr = strongComponentIndexVertexGroupMap.begin(); svmItr != strongComponentIndexVertexGroupMap.end(); ++svmItr ) {
VertexVector vertexVector = svmItr->second;
if ( vertexVector.size() <= 1 ) continue;
error.append( "\n" );
for( VertexVector::iterator vtvItr = vertexVector.begin(); vtvItr != vertexVector.end(); ++vtvItr ) {
error.append( blockVector[ *vtvItr ].getPath("/") );
error.append( ", " );
}
error.erase( error.size() - 2 );
}
throw udm_exception(error);
}
typedef std::set< Vertex > VertexSet;
typedef std::map< int, VertexSet > PriorityVertexSetMap;
PriorityVertexSetMap priorityVertexSetMap;
for( BlockVector::iterator blvItr = blockVector.begin() ; blvItr != blockVector.end() ; ++blvItr ) {
SLSF::Block block = *blvItr;
int priority = block.Priority();
if ( priority == 0 ) continue;
Vertex vertex = blockVertexIndexMap[ block ];
priorityVertexSetMap[ priority ].insert( vertex );
}
if ( priorityVertexSetMap.size() > 1 ) {
PriorityVertexSetMap::iterator lstPvmItr = priorityVertexSetMap.end();
--lstPvmItr;
for( PriorityVertexSetMap::iterator pvmItr = priorityVertexSetMap.begin() ; pvmItr != lstPvmItr ; ) {
PriorityVertexSetMap::iterator nxtPvmItr = pvmItr;
++nxtPvmItr;
VertexSet &higherPriorityVertexSet = pvmItr->second;
VertexSet &lowerPriorityVertexSet = nxtPvmItr->second;
for( VertexSet::iterator hvsItr = higherPriorityVertexSet.begin() ; hvsItr != higherPriorityVertexSet.end() ; ++hvsItr ) {
for( VertexSet::iterator lvsItr = lowerPriorityVertexSet.begin() ; lvsItr != lowerPriorityVertexSet.end() ; ++lvsItr ) {
boost::add_edge( *hvsItr, *lvsItr, graph );
LoopDetector loopDetector( graph );
if ( loopDetector.check( *hvsItr ) ) {
SLSF::Block higherPriorityBlock = vertexIndexBlockMap[ *hvsItr ];
SLSF::Block lowerPriorityBlock = vertexIndexBlockMap[ *lvsItr ];
std::cerr << "WARNING: Cannot implement priority difference between block \"" << higherPriorityBlock.getPath( "/" ) << "\" (Priority = " << *hvsItr << ") and " << std::endl;
std::cerr << " block \"" << lowerPriorityBlock.getPath( "/" ) << "\" (Priority = " << *lvsItr << "): contradicts topology of subsystem or other implemented block priority order." << std::endl;
boost::remove_edge( *hvsItr, *lvsItr, graph );
}
}
}
pvmItr = nxtPvmItr;
}
}
VertexList vertexList;
boost::topological_sort( graph, std::back_inserter( vertexList ) );
/* PUT ALL "DataStoreMemory" BLOCKS AT END OF "C" SO THEY HAVE HIGHEST PRIORITY */
VertexList::reverse_iterator vtlRit = vertexList.rbegin();
while( vtlRit != vertexList.rend() ) {
int index = *vtlRit;
SLSF::Block block = vertexIndexBlockMap[ index ];
(void)++vtlRit;
if ( block != Udm::null && static_cast< std::string >( block.BlockType() ) == "DataStoreMemory" ) {
VertexList::reverse_iterator vtlRit2 = vtlRit;
vertexList.splice( vertexList.end(), vertexList, vtlRit2.base() );
}
}
int priority = 0;
for( VertexList::reverse_iterator vtlRit = vertexList.rbegin() ; vtlRit != vertexList.rend() ; ++vtlRit ) {
int index = *vtlRit;
SLSF::Block block = vertexIndexBlockMap[ index ];
if ( block == Udm::null ) { // unit delay as source is not registered - we will invoke it initially, and invoke it as destination in the priority order
// const std::string& bt = blk.BlockType();
// assert(bt.compare("UnitDelay") == 0);
/* Unit Delay Block as destination */
continue;
}
block.Priority() = priority++;
}
}