60 int main(
int argc,
char *argv[])
68 MPI_Init(&argc, &argv);
71 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
84 if (argc>1)
if (argv[1][0]==
'-' && argv[1][1]==
'v') verbose =
true;
86 int verbose_int = verbose ? 1 : 0;
88 verbose = verbose_int==1 ? true :
false;
91 int MyPID = Comm.
MyPID();
94 if(verbose && MyPID==0)
97 if (verbose) std::cout <<
"Processor "<<MyPID<<
" of "<< NumProc
98 <<
" is alive."<< std::endl;
103 if(verbose && rank!=0)
106 if (verbose) std::cout <<
"Test the memory management system of the class CrsMatrix (memory leak, invalid free)" << std::endl;
114 if (verbose) std::cout <<
"* Using Copy, ColMap, Variable number of indices per row and Static profile (cf. bug #5499)." << std::endl;
120 std::vector<int> colids(2);
123 Epetra_Map ColMap(-1, 2, &colids[0], 0, Comm);
126 std::vector<int> NumEntriesPerRow(2);
127 NumEntriesPerRow[0]=2;
128 NumEntriesPerRow[1]=2;
143 if (verbose) std::cout <<
"* Using Copy, Fixed number of indices per row and Static profile" << std::endl;
160 if (verbose) std::cout <<
"* Using Copy, Fixed number of indices per row and Static profile + InsertGlobalValues()." << std::endl;
166 std::vector<int> Indices(1);
167 std::vector<double> Values(1);
171 A.InsertGlobalValues(0, 1, &Values[0], &Indices[0]);
183 if (verbose) std::cout <<
"* Using Copy, Fixed number of indices per row and Dynamic profile" << std::endl;
199 if (verbose) std::cout <<
"* Using Copy, Fixed number of indices per row and Dynamic profile + InsertGlobalValues()." << std::endl;
205 std::vector<int> Indices(1);
206 std::vector<double> Values(1);
210 A.InsertGlobalValues(0, 1, &Values[0], &Indices[0]);
217 if (verbose) std::cout <<
"* Using Copy, Static Graph()." << std::endl;
223 std::vector<int> Indices(1);
229 std::vector<double> Values(1);
231 A.ReplaceGlobalValues(0, 1, &Values[0], &Indices[0]);
233 double norminf =
A.NormInf();
234 if (verbose) std::cout <<
"** Inf Norm of Matrix = " << norminf <<
"." << std::endl;
235 std::cout <<
A << std::endl;
243 if (verbose) std::cout <<
"* Using Copy, Fixed number of indices per row and static profile + InsertGlobalValues() for a single row." << std::endl;
249 std::vector<int> Indices(1);
250 std::vector<double> Values(1);
254 A.InsertGlobalValues(0, 1, &Values[0], &Indices[0]);
264 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.
int main(int argc, char *argv[])
static void SetTracebackMode(int TracebackModeValue)
Set the value of the Epetra_Object error traceback report mode.
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. ...