本文整理汇总了C++中Epetra_CrsGraph::NumGlobalNonzeros64方法的典型用法代码示例。如果您正苦于以下问题:C++ Epetra_CrsGraph::NumGlobalNonzeros64方法的具体用法?C++ Epetra_CrsGraph::NumGlobalNonzeros64怎么用?C++ Epetra_CrsGraph::NumGlobalNonzeros64使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Epetra_CrsGraph
的用法示例。
在下文中一共展示了Epetra_CrsGraph::NumGlobalNonzeros64方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check
int check(Epetra_CrsGraph& L, Epetra_CrsGraph& U, Ifpack_IlukGraph& LU,
long long NumGlobalRows1, int NumMyRows1, int LevelFill1, bool verbose) {
using std::cout;
using std::endl;
int i, j;
int NumIndices, * Indices;
int NumIndices1, * Indices1;
bool debug = true;
Epetra_CrsGraph& L1 = LU.L_Graph();
Epetra_CrsGraph& U1 = LU.U_Graph();
// Test entries and count nonzeros
int Nout = 0;
for (i=0; i<LU.NumMyRows(); i++) {
assert(L.ExtractMyRowView(i, NumIndices, Indices)==0);
assert(L1.ExtractMyRowView(i, NumIndices1, Indices1)==0);
assert(NumIndices==NumIndices1);
for (j=0; j<NumIndices1; j++) {
if (debug &&(Indices[j]!=Indices1[j])) {
int MyPID = L.RowMap().Comm().MyPID();
cout << "Proc " << MyPID
<< " Local Row = " << i
<< " L.Indices["<< j <<"] = " << Indices[j]
<< " L1.Indices["<< j <<"] = " << Indices1[j] << endl;
}
assert(Indices[j]==Indices1[j]);
}
Nout += (NumIndices-NumIndices1);
assert(U.ExtractMyRowView(i, NumIndices, Indices)==0);
assert(U1.ExtractMyRowView(i, NumIndices1, Indices1)==0);
assert(NumIndices==NumIndices1);
for (j=0; j<NumIndices1; j++) {
if (debug &&(Indices[j]!=Indices1[j])) {
int MyPID = L.RowMap().Comm().MyPID();
cout << "Proc " << MyPID
<< " Local Row = " << i
<< " U.Indices["<< j <<"] = " << Indices[j]
<< " U1.Indices["<< j <<"] = " << Indices1[j] << endl;
}
assert(Indices[j]==Indices1[j]);
}
Nout += (NumIndices-NumIndices1);
}
// Test query functions
long long NumGlobalRows = LU.NumGlobalRows64();
if (verbose) cout << "\n\nNumber of Global Rows = " << NumGlobalRows << endl<< endl;
assert(NumGlobalRows==NumGlobalRows1);
long long NumGlobalNonzeros = LU.NumGlobalNonzeros64();
if (verbose) cout << "\n\nNumber of Global Nonzero entries = "
<< NumGlobalNonzeros << endl<< endl;
int NoutG = 0;
L.RowMap().Comm().SumAll(&Nout, &NoutG, 1);
assert(NumGlobalNonzeros==L.NumGlobalNonzeros64()+U.NumGlobalNonzeros64()-NoutG);
int NumMyRows = LU.NumMyRows();
if (verbose) cout << "\n\nNumber of Rows = " << NumMyRows << endl<< endl;
assert(NumMyRows==NumMyRows1);
int NumMyNonzeros = LU.NumMyNonzeros();
if (verbose) cout << "\n\nNumber of Nonzero entries = " << NumMyNonzeros << endl<< endl;
assert(NumMyNonzeros==L.NumMyNonzeros()+U.NumMyNonzeros()-Nout);
if (verbose) cout << "\n\nLU check OK" << endl<< endl;
return(0);
}
示例2: check
//==============================================================================
int check(Epetra_CrsGraph& A, int NumMyRows1, long long NumGlobalRows1, int NumMyNonzeros1,
long long NumGlobalNonzeros1, long long* MyGlobalElements, bool verbose)
{
(void)MyGlobalElements;
int ierr = 0;
int i;
int j;
int forierr = 0;
int NumGlobalIndices;
int NumMyIndices;
int* MyViewIndices;
int MaxNumIndices = A.MaxNumIndices();
int* MyCopyIndices = new int[MaxNumIndices];
long long* GlobalCopyIndices = new long long[MaxNumIndices];
// Test query functions
int NumMyRows = A.NumMyRows();
if(verbose) cout << "Number of local Rows = " << NumMyRows << endl;
EPETRA_TEST_ERR(!(NumMyRows==NumMyRows1),ierr);
int NumMyNonzeros = A.NumMyNonzeros();
if(verbose) cout << "Number of local Nonzero entries = " << NumMyNonzeros << endl;
EPETRA_TEST_ERR(!(NumMyNonzeros==NumMyNonzeros1),ierr);
long long NumGlobalRows = A.NumGlobalRows64();
if(verbose) cout << "Number of global Rows = " << NumGlobalRows << endl;
EPETRA_TEST_ERR(!(NumGlobalRows==NumGlobalRows1),ierr);
long long NumGlobalNonzeros = A.NumGlobalNonzeros64();
if(verbose) cout << "Number of global Nonzero entries = " << NumGlobalNonzeros << endl;
EPETRA_TEST_ERR(!(NumGlobalNonzeros==NumGlobalNonzeros1),ierr);
// GlobalRowView should be illegal (since we have local indices)
EPETRA_TEST_ERR(!(A.ExtractGlobalRowView(A.RowMap().MaxMyGID64(), NumGlobalIndices, GlobalCopyIndices)==-2),ierr);
// Other binary tests
EPETRA_TEST_ERR(A.NoDiagonal(),ierr);
EPETRA_TEST_ERR(!(A.Filled()),ierr);
EPETRA_TEST_ERR(!(A.MyGRID(A.RowMap().MaxMyGID64())),ierr);
EPETRA_TEST_ERR(!(A.MyGRID(A.RowMap().MinMyGID64())),ierr);
EPETRA_TEST_ERR(A.MyGRID(1+A.RowMap().MaxMyGID64()),ierr);
EPETRA_TEST_ERR(A.MyGRID(-1+A.RowMap().MinMyGID64()),ierr);
EPETRA_TEST_ERR(!(A.MyLRID(0)),ierr);
EPETRA_TEST_ERR(!(A.MyLRID(NumMyRows-1)),ierr);
EPETRA_TEST_ERR(A.MyLRID(-1),ierr);
EPETRA_TEST_ERR(A.MyLRID(NumMyRows),ierr);
forierr = 0;
for(i = 0; i < NumMyRows; i++) {
long long Row = A.GRID64(i);
A.ExtractGlobalRowCopy(Row, MaxNumIndices, NumGlobalIndices, GlobalCopyIndices);
A.ExtractMyRowView(i, NumMyIndices, MyViewIndices);
forierr += !(NumGlobalIndices==NumMyIndices);
for(j = 1; j < NumMyIndices; j++) EPETRA_TEST_ERR(!(MyViewIndices[j-1]<MyViewIndices[j]),ierr);
for(j = 0; j < NumGlobalIndices; j++) {
forierr += !(GlobalCopyIndices[j]==A.GCID64(MyViewIndices[j]));
forierr += !(A.LCID(GlobalCopyIndices[j])==MyViewIndices[j]);
}
}
EPETRA_TEST_ERR(forierr,ierr);
forierr = 0;
for(i = 0; i < NumMyRows; i++) {
long long Row = A.GRID64(i);
A.ExtractGlobalRowCopy(Row, MaxNumIndices, NumGlobalIndices, GlobalCopyIndices);
A.ExtractMyRowCopy(i, MaxNumIndices, NumMyIndices, MyCopyIndices);
forierr += !(NumGlobalIndices==NumMyIndices);
for(j = 1; j < NumMyIndices; j++)
EPETRA_TEST_ERR(!(MyCopyIndices[j-1]<MyCopyIndices[j]),ierr);
for(j = 0; j < NumGlobalIndices; j++) {
forierr += !(GlobalCopyIndices[j]==A.GCID64(MyCopyIndices[j]));
forierr += !(A.LCID(GlobalCopyIndices[j])==MyCopyIndices[j]);
}
}
EPETRA_TEST_ERR(forierr,ierr);
delete[] MyCopyIndices;
delete[] GlobalCopyIndices;
if(verbose) cout << "Rows sorted check OK" << endl;
return(ierr);
}