18 #define ITYPE long long
19 #define OFFSET_EPETRA64 0
28 #define FINALIZE MPI_Finalize()
49 #define MIN(a,b) ((a) < (b) ? (a) : (b))
51 int main(
int narg,
char *arg[])
63 int me = comm.
MyPID();
66 ITYPE nGlobalRows = 10;
68 nGlobalRows = (
ITYPE) atol(arg[1]);
70 bool verbose = (nGlobalRows < 20);
74 int nMyRows = (int) (nGlobalRows / np + (nGlobalRows % np > me));
75 ITYPE myFirstRow = (
ITYPE)(me * (nGlobalRows / np) +
MIN(nGlobalRows%np, me));
77 for (
int i = 0; i < nMyRows; i++)
80 if (verbose) rowMap->
Print(std::cout);
84 std::vector<int> nnzPerRow(nMyRows+1, 0);
89 std::vector<ITYPE> iv(3*nMyRows+1);
90 std::vector<ITYPE> jv(3*nMyRows+1);
91 std::vector<double> vv(3*nMyRows+1);
94 ITYPE nMyNonzeros = 0;
95 for (
ITYPE i = 0, myrowcnt = 0; i < nGlobalRows; i++) {
96 if (rowMap->
MyGID(i+OFFSET_EPETRA64)) {
101 vv[nMyNonzeros] = -1;
103 std::cout <<
"(" << iv[nMyNonzeros] <<
"," << jv[nMyNonzeros] <<
")="
104 << vv[nMyNonzeros] <<
" on processor " << me
105 <<
" in " << myrowcnt << std::endl;
107 nnzPerRow[myrowcnt]++;
112 vv[nMyNonzeros] = ((i == 0 || i == nGlobalRows-1) ? 1. : 2.);
114 std::cout <<
"(" << iv[nMyNonzeros] <<
"," << jv[nMyNonzeros] <<
")="
115 << vv[nMyNonzeros] <<
" on processor " << me
116 <<
" in " << myrowcnt << std::endl;
118 nnzPerRow[myrowcnt]++;
120 if (i < nGlobalRows - 1) {
123 vv[nMyNonzeros] = -1;
125 std::cout <<
"(" << iv[nMyNonzeros] <<
"," << jv[nMyNonzeros] <<
")="
126 << vv[nMyNonzeros] <<
" on processor " << me
127 <<
" in " << myrowcnt << std::endl;
129 nnzPerRow[myrowcnt]++;
143 for (
int i=0; i < nMyRows; i++) {
146 std::cout <<
"InsertGlobalValus row " << iv[sum]
147 <<
" count " << nnzPerRow[i]
148 <<
" cols " << jv[sum] <<
" " << jv[sum+1] <<
" ";
149 if (nnzPerRow[i] == 3) std::cout << jv[sum+2];
150 std::cout << std::endl;
167 if (verbose) A->
Print(std::cout);
174 A->
Multiply(
false, sanity, sanityres);
176 double jjone, jjtwo, jjmax;
177 sanityres.Norm1(&jjone);
178 sanityres.Norm2(&jjtwo);
179 sanityres.NormInf(&jjmax);
181 std::cout <<
"SanityTest norms 1/2/inf: " << jjone <<
" "
182 << jjtwo <<
" " << jjmax << std::endl;
184 bool test_failed = (jjone != 0) || (jjtwo != 0) || (jjmax != 0);
186 sanityres.MinValue(&jjone);
187 sanityres.MeanValue(&jjtwo);
188 sanityres.MaxValue(&jjmax);
190 std::cout <<
"SanityTest values min/max/avg: " << jjone <<
" "
191 << jjmax <<
" " << jjtwo << std::endl;
193 test_failed = test_failed || (jjone != 0) || (jjtwo != 0) || (jjmax != 0);
197 std::cout <<
"Bug_5791_StaticProifle_LL tests FAILED" << std::endl;
202 delete [] myGlobalRows;
Epetra_Map: A class for partitioning vectors and matrices.
const Epetra_Map & RangeMap() const
Returns the Epetra_Map object associated with the range of this matrix operator.
int Multiply(bool TransA, const Epetra_Vector &x, Epetra_Vector &y) const
Returns the result of a Epetra_CrsMatrix multiplied by a Epetra_Vector x in y.
virtual void Print(std::ostream &os) const
Print object to an output stream.
int PutScalar(double ScalarConstant)
Initialize all values in a multi-vector with constant value.
virtual int InsertGlobalValues(int GlobalRow, int NumEntries, const double *Values, const int *Indices)
Insert a list of elements in a given global row of the matrix.
Epetra_Vector: A class for constructing and using dense vectors on a parallel computer.
int MyPID() const
Return my process ID.
Epetra_MpiComm: The Epetra MPI Communication Class.
int FillComplete(bool OptimizeDataStorage=true)
Signal that data entry is complete. Perform transformations to local index space. ...
virtual void Print(std::ostream &os) const
Print method.
bool MyGID(int GID_in) const
Returns true if the GID passed in belongs to the calling processor in this map, otherwise returns fal...
int NumProc() const
Returns total number of processes (always returns 1 for SerialComm).
Epetra_SerialComm: The Epetra Serial Communication Class.
Epetra_CrsMatrix: A class for constructing and using real-valued double-precision sparse compressed r...
const Epetra_Map & DomainMap() const
Returns the Epetra_Map object associated with the domain of this matrix operator. ...
int main(int argc, char *argv[])