61 int main(
int argc,
char *argv[])
69 MPI_Init(&argc, &argv);
72 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
85 if (argc>1)
if (argv[1][0]==
'-' && argv[1][1]==
'v') verbose =
true;
87 int verbose_int = verbose ? 1 : 0;
89 verbose = verbose_int==1 ? true :
false;
92 int MyPID = Comm.
MyPID();
95 if(verbose && MyPID==0)
98 if (verbose) std::cout <<
"Processor "<<MyPID<<
" of "<< NumProc
99 <<
" is alive."<< std::endl;
104 if(verbose && rank!=0)
107 if (verbose) std::cout <<
"Test the memory management system of the class CrsMatrix (memory leak, invalid free)" << std::endl;
115 if (verbose) std::cout <<
"* Using Copy, ColMap, Variable number of indices per row and Static profile (cf. bug #5499)." << std::endl;
121 std::vector<long long> colids(2);
124 Epetra_Map ColMap(-1LL, 2, &colids[0], 0LL, Comm);
127 std::vector<int> NumEntriesPerRow(2);
128 NumEntriesPerRow[0]=2;
129 NumEntriesPerRow[1]=2;
144 if (verbose) std::cout <<
"* Using Copy, Fixed number of indices per row and Static profile" << std::endl;
161 if (verbose) std::cout <<
"* Using Copy, Fixed number of indices per row and Static profile + InsertGlobalValues()." << std::endl;
167 std::vector<long long> Indices(1);
168 std::vector<double> Values(1);
172 A.InsertGlobalValues(0, 1, &Values[0], &Indices[0]);
184 if (verbose) std::cout <<
"* Using Copy, Fixed number of indices per row and Dynamic profile" << std::endl;
200 if (verbose) std::cout <<
"* Using Copy, Fixed number of indices per row and Dynamic profile + InsertGlobalValues()." << std::endl;
206 std::vector<long long> Indices(1);
207 std::vector<double> Values(1);
211 A.InsertGlobalValues(0, 1, &Values[0], &Indices[0]);
218 if (verbose) std::cout <<
"* Using Copy, Static Graph()." << std::endl;
224 std::vector<long long> Indices(1);
230 std::vector<double> Values(1);
232 A.ReplaceGlobalValues(0, 1, &Values[0], &Indices[0]);
234 double norminf =
A.NormInf();
235 if (verbose) std::cout <<
"** Inf Norm of Matrix = " << norminf <<
"." << std::endl;
236 std::cout <<
A << std::endl;
244 if (verbose) std::cout <<
"* Using Copy, Fixed number of indices per row and static profile + InsertGlobalValues() for a single row." << std::endl;
250 std::vector<long long> Indices(1);
251 std::vector<double> Values(1);
255 A.InsertGlobalValues(0, 1, &Values[0], &Indices[0]);
265 if (verbose) std::cout << std::endl <<
"tests PASSED" << std::endl << std::endl;
Epetra_Map: A class for partitioning vectors and matrices.
int FillComplete()
Tranform to local index space. Perform other operations to allow optimal matrix operations.
static void SetTracebackMode(int TracebackModeValue)
Set the value of the Epetra_Object error traceback report mode.
int main(int argc, char *argv[])
Epetra_MpiComm: The Epetra MPI Communication Class.
std::string Epetra_Version()
int NumProc() const
Returns total number of processes (always returns 1 for SerialComm).
int Broadcast(double *MyVals, int Count, int Root) const
Epetra_SerialComm Broadcast function.
int InsertGlobalIndices(int GlobalRow, int NumIndices, int *Indices)
Enter a list of elements in a specified global row of the graph.
Epetra_SerialComm: The Epetra Serial Communication Class.
int MyPID() const
Return my process ID.
Epetra_CrsMatrix: A class for constructing and using real-valued double-precision sparse compressed r...
Epetra_CrsGraph: A class for constructing and using sparse compressed row graphs. ...