59 int mypid = comm.
MyPID();
64 for(
int i=0; i<numargs; ++i) {
65 if (strargs[i]==0)
continue;
67 if (strcmp(flag, strargs[i]) == 0) {
68 flag_found = 1;
break;
77 bool return_value = flag_found==1 ? true :
false;
79 return( return_value );
85 MPI_Init(&argc, &argv);
106 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES 111 for(
int i=0; i<numRows; ++i) {
113 int rowLen =
A.NumGlobalEntries(row);
114 if (rowLen !=
B.NumGlobalEntries(row)) {
118 int* indices =
new int[rowLen*2];
119 int* Bindices = indices+rowLen;
121 double* values =
new double[rowLen*2];
122 double* Bvalues = values+rowLen;
124 A.ExtractGlobalRowCopy(row, rowLen, rowLen, values, indices);
125 B.ExtractGlobalRowCopy(row, rowLen, rowLen, Bvalues, Bindices);
127 util.
Sort(
true, rowLen, indices, 1, &values, 0, 0, 0, 0);
128 util.
Sort(
true, rowLen, Bindices, 1, &Bvalues, 0, 0, 0, 0);
131 for(
int j=0; j<rowLen; ++j) {
132 if (indices[j] != Bindices[j]) {
135 if (values[j] != Bvalues[j]) {
148 throw "compare_matrices: GlobalIndices int but not API for it.";
152 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 158 for(
int i=0; i<numRows; ++i) {
159 long long row = rows[i];
160 int rowLen =
A.NumGlobalEntries(row);
161 if (rowLen !=
B.NumGlobalEntries(row)) {
165 long long* indices =
new long long[rowLen*2];
166 long long* Bindices = indices+rowLen;
168 double* values =
new double[rowLen*2];
169 double* Bvalues = values+rowLen;
171 A.ExtractGlobalRowCopy(row, rowLen, rowLen, values, indices);
172 B.ExtractGlobalRowCopy(row, rowLen, rowLen, Bvalues, Bindices);
174 util.
Sort(
true, rowLen, indices, 1, &values, 0, 0, 0, 0);
175 util.
Sort(
true, rowLen, Bindices, 1, &Bvalues, 0, 0, 0, 0);
178 for(
int j=0; j<rowLen; ++j) {
179 if (indices[j] != Bindices[j]) {
182 if (values[j] != Bvalues[j]) {
195 throw "compare_matrices: GlobalIndices long long but not API for it.";
bool compare_matrices_LL(const Epetra_CrsMatrix &A, const Epetra_CrsMatrix &B)
int MyGlobalElements(int *MyGlobalElementList) const
Puts list of global elements on this processor into the user-provided array.
Epetra_Map: A class for partitioning vectors and matrices.
Epetra_Comm * create_comm(int argc, char **argv)
If macro EPETRA_MPI is defined, call MPI_Init and then return new Epetra_MpiComm. ...
bool global_check_for_flag_on_proc_0(const char *flag, int numargs, char **strargs, const Epetra_Comm &comm)
Check through a list of C-style string arguments searching for a specified flag on proc 0...
Epetra_MpiComm: The Epetra MPI Communication Class.
long long * MyGlobalElements64() const
virtual int MyPID() const =0
Return my process ID.
Epetra_Util: The Epetra Util Wrapper Class.
Epetra_Comm: The Epetra Communication Abstract Base Class.
bool GlobalIndicesInt() const
Returns true if map create with int NumGlobalElements.
int NumMyElements() const
Number of elements on the calling processor.
bool compare_matrices(const Epetra_CrsMatrix &A, const Epetra_CrsMatrix &B)
Check whether the two CrsMatrix arguments have the same size, structure and coefs.
virtual int Broadcast(double *MyVals, int Count, int Root) const =0
Epetra_Comm Broadcast function.
Epetra_SerialComm: The Epetra Serial Communication Class.
virtual int NumProc() const =0
Returns total number of processes.
Epetra_CrsMatrix: A class for constructing and using real-valued double-precision sparse compressed r...
static void Sort(bool SortAscending, int NumKeys, T *Keys, int NumDoubleCompanions, double **DoubleCompanions, int NumIntCompanions, int **IntCompanions, int NumLongLongCompanions, long long **LongLongCompanions)
Epetra_Util Sort Routine (Shell sort)
bool GlobalIndicesLongLong() const
Returns true if map create with long long NumGlobalElements.
bool PointSameAs(const Epetra_BlockMap &Map) const
Returns true if this and Map have identical point-wise structure.