本文整理汇总了C++中Epetra_CrsGraph::IndicesAreGlobal方法的典型用法代码示例。如果您正苦于以下问题:C++ Epetra_CrsGraph::IndicesAreGlobal方法的具体用法?C++ Epetra_CrsGraph::IndicesAreGlobal怎么用?C++ Epetra_CrsGraph::IndicesAreGlobal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Epetra_CrsGraph
的用法示例。
在下文中一共展示了Epetra_CrsGraph::IndicesAreGlobal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TGenerateRowStencil
void BlockUtility::TGenerateRowStencil(const Epetra_CrsGraph& LocalBlockGraph,
std::vector<int_type> RowIndices,
std::vector< std::vector<int_type> >& RowStencil)
{
// Get row indices
int NumMyRows = LocalBlockGraph.NumMyRows();
RowIndices.resize(NumMyRows);
const Epetra_BlockMap& RowMap = LocalBlockGraph.RowMap();
RowMap.MyGlobalElements(&RowIndices[0]);
// Get stencil
RowStencil.resize(NumMyRows);
if (LocalBlockGraph.IndicesAreGlobal()) {
for (int i=0; i<NumMyRows; i++) {
int_type Row = RowIndices[i];
int NumCols = LocalBlockGraph.NumGlobalIndices(Row);
RowStencil[i].resize(NumCols);
LocalBlockGraph.ExtractGlobalRowCopy(Row, NumCols, NumCols,
&RowStencil[i][0]);
for (int k=0; k<NumCols; k++)
RowStencil[i][k] -= Row;
}
}
else {
for (int i=0; i<NumMyRows; i++) {
int NumCols = LocalBlockGraph.NumMyIndices(i);
std::vector<int> RowStencil_local(NumCols);
RowStencil[i].resize(NumCols);
LocalBlockGraph.ExtractMyRowCopy(i, NumCols, NumCols,
&RowStencil_local[0]);
for (int k=0; k<NumCols; k++)
RowStencil[i][k] = (int_type) ((int) (LocalBlockGraph.GCID64(RowStencil_local[k]) - RowIndices[i]));
}
}
}