本文整理汇总了C++中Epetra_CrsGraph::LRID方法的典型用法代码示例。如果您正苦于以下问题:C++ Epetra_CrsGraph::LRID方法的具体用法?C++ Epetra_CrsGraph::LRID怎么用?C++ Epetra_CrsGraph::LRID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Epetra_CrsGraph
的用法示例。
在下文中一共展示了Epetra_CrsGraph::LRID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: matrixGlobalToLocal
//-----------------------------------------------------------------------------
// Function : Indexor::matrixGlobalToLocal
// Purpose :
// Special Notes :
// Scope : public
// Creator : Rob Hoekstra, SNL, Parallel Computational Sciences
// Creation Date : 08/23/02
//-----------------------------------------------------------------------------
bool Indexor::matrixGlobalToLocal( const std::string & graph_name,
const std::vector<int> & gids,
std::vector< std::vector<int> > & stamp )
{
Epetra_CrsGraph * graph = 0;
assert( pdsMgr_ != 0 );
// Never, EVER do work inside an assert argument, or that work will not
// be done when asserts are disabled.
graph = pdsMgr_->getMatrixGraph( graph_name );
assert( graph != 0 );
int numRows = stamp.size();
int numElements;
int * elements;
if( accelMatrixIndex_ )
{
for( int i = 0; i < numRows; ++i )
{
int RowLID = graph->LRID(gids[i]);
int NumCols = stamp[i].size();
for( int j = 0; j < NumCols; ++j )
{
int lid = graph->LCID(stamp[i][j]);
stamp[i][j] = matrixIndexMap_[RowLID][lid];
}
}
}
else
{
for( int i = 0; i < numRows; ++i )
{
graph->ExtractMyRowView( graph->LRID(gids[i]), numElements, elements );
std::map<int,int> indexToOffsetMap;
for( int j = 0; j < numElements; ++j ) indexToOffsetMap[ elements[j] ] = j;
int numCols = stamp[i].size();
for( int j = 0; j < numCols; ++j )
{
int lid = graph->LCID(stamp[i][j]);
// assert( indexToOffsetMap.count(lid) );
stamp[i][j] = indexToOffsetMap[lid];
}
}
}
return true;
}