本文整理汇总了C++中teuchos::RefCountPtr::InsertGlobalIndices方法的典型用法代码示例。如果您正苦于以下问题:C++ RefCountPtr::InsertGlobalIndices方法的具体用法?C++ RefCountPtr::InsertGlobalIndices怎么用?C++ RefCountPtr::InsertGlobalIndices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类teuchos::RefCountPtr
的用法示例。
在下文中一共展示了RefCountPtr::InsertGlobalIndices方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ComputePartitions
//==============================================================================
// NOTE:
// - matrix is supposed to be localized, and passes through the
// singleton filter. This means that I do not have to look
// for Dirichlet nodes (singletons). Also, all rows and columns are
// local.
int Ifpack_METISPartitioner::ComputePartitions()
{
int ierr;
#ifdef HAVE_IFPACK_METIS
int nbytes = 0;
int edgecut;
#endif
Teuchos::RefCountPtr<Epetra_CrsGraph> SymGraph ;
Teuchos::RefCountPtr<Epetra_Map> SymMap;
Teuchos::RefCountPtr<Ifpack_Graph_Epetra_CrsGraph> SymIFPACKGraph;
Teuchos::RefCountPtr<Ifpack_Graph> IFPACKGraph = Teuchos::rcp( (Ifpack_Graph*)Graph_, false );
int Length = 2 * MaxNumEntries();
int NumIndices;
std::vector<int> Indices;
Indices.resize(Length);
/* construct the CSR graph information of the LOCAL matrix
using the get_row function */
std::vector<idxtype> wgtflag;
wgtflag.resize(4);
std::vector<int> options;
options.resize(4);
int numflag;
if (UseSymmetricGraph_) {
#if !defined(EPETRA_NO_32BIT_GLOBAL_INDICES) || !defined(EPETRA_NO_64BIT_GLOBAL_INDICES)
// need to build a symmetric graph.
// I do this in two stages:
// 1.- construct an Epetra_CrsMatrix, symmetric
// 2.- convert the Epetra_CrsMatrix into METIS format
SymMap = Teuchos::rcp( new Epetra_Map(NumMyRows(),0,Graph_->Comm()) );
SymGraph = Teuchos::rcp( new Epetra_CrsGraph(Copy,*SymMap,0) );
#endif
#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
if(SymGraph->RowMap().GlobalIndicesInt()) {
for (int i = 0; i < NumMyRows() ; ++i) {
ierr = Graph_->ExtractMyRowCopy(i, Length, NumIndices, &Indices[0]);
IFPACK_CHK_ERR(ierr);
for (int j = 0 ; j < NumIndices ; ++j) {
int jj = Indices[j];
if (jj != i) {
SymGraph->InsertGlobalIndices(i,1,&jj);
SymGraph->InsertGlobalIndices(jj,1,&i);
}
}
}
}
else
#endif
#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
if(SymGraph->RowMap().GlobalIndicesLongLong()) {
for (int i = 0; i < NumMyRows() ; ++i) {
long long i_LL = i;
ierr = Graph_->ExtractMyRowCopy(i, Length, NumIndices, &Indices[0]);
IFPACK_CHK_ERR(ierr);
for (int j = 0 ; j < NumIndices ; ++j) {
long long jj = Indices[j];
if (jj != i_LL) {
SymGraph->InsertGlobalIndices(i_LL,1,&jj);
SymGraph->InsertGlobalIndices(jj,1,&i_LL);
}
}
}
}
else
#endif
throw "Ifpack_METISPartitioner::ComputePartitions: GlobalIndices type unknown";
IFPACK_CHK_ERR(SymGraph->FillComplete());
SymIFPACKGraph = Teuchos::rcp( new Ifpack_Graph_Epetra_CrsGraph(SymGraph) );
IFPACKGraph = SymIFPACKGraph;
}
// now work on IFPACKGraph, that can be the symmetric or
// the non-symmetric one
/* set parameters */
wgtflag[0] = 0; /* no weights */
numflag = 0; /* C style */
options[0] = 0; /* default options */
//.........这里部分代码省略.........