43 #ifdef HAVE_EXPERIMENTAL
44 #ifdef HAVE_GRAPH_REORDERINGS
74 int n = orig.NumMyRows();
75 int nnz = orig.NumMyNonzeros();
78 std::vector<int> ia(n+1,0);
79 std::vector<int> ja(nnz);
81 for(
int i = 0; i < n; ++i )
83 int * tmpP = &ja[ia[i]];
84 orig.ExtractMyRowCopy( i, nnz-ia[i], cnt, tmpP );
85 ia[i+1] = ia[i] + cnt;
89 std::vector<int> iat(n+1);
90 std::vector<int> jat(nnz);
92 for(
int i = 0; i < n; ++i )
95 for(
int j = ia[i]; j < ia[i+1]; ++j )
108 std::cout <<
"Orig Graph\n";
109 std::cout << orig << std::endl;
110 std::cout <<
"-----------------------------------------\n";
111 std::cout <<
"CRS Format Graph\n";
112 std::cout <<
"-----------------------------------------\n";
113 for(
int i = 0; i < n; ++i )
115 std::cout << i <<
": " << iat[i+1] <<
": ";
116 for(
int j = iat[i]; j<iat[i+1]; ++j )
117 std::cout <<
" " << jat[j];
118 std::cout << std::endl;
120 std::cout <<
"-----------------------------------------\n";
123 std::vector<int> perm(n);
124 std::vector<double> info(AMD_INFO);
126 amd_order( n, iat.data(), jat.data(), perm.data(), NULL, &info[0] );
128 if( info[AMD_STATUS] == AMD_INVALID )
129 std::cout <<
"AMD ORDERING: Invalid!!!!\n";
133 std::cout <<
"-----------------------------------------\n";
134 std::cout <<
"AMD Output\n";
135 std::cout <<
"-----------------------------------------\n";
136 std::cout <<
"STATUS: " << info[AMD_STATUS] << std::endl;
137 std::cout <<
"SYMM: " << info[AMD_SYMMETRY] << std::endl;
138 std::cout <<
"N: " << info[AMD_N] << std::endl;
139 std::cout <<
"NZ: " << info[AMD_NZ] << std::endl;
140 std::cout <<
"SYMM: " << info[AMD_SYMMETRY] << std::endl;
141 std::cout <<
"NZDIAG: " << info[AMD_NZDIAG] << std::endl;
142 std::cout <<
"NZ A+At: " << info[AMD_NZ_A_PLUS_AT] << std::endl;
143 std::cout <<
"NDENSE: " << info[AMD_SYMMETRY] << std::endl;
144 std::cout <<
"Perm\n";
145 for(
int i = 0; i<n; ++i )
146 std::cout << perm[i] << std::endl;
147 std::cout <<
"-----------------------------------------\n";
154 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
156 int nG = orig.NumGlobalRows();
157 std::vector<int> newElements( n );
158 for(
int i = 0; i < n; ++i )
159 newElements[i] = OldMap.
GID( perm[i] );
165 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
167 long long nG = orig.NumGlobalRows64();
168 std::vector<long long> newElements( nG );
169 for(
int i = 0; i < n; ++i )
170 newElements[i] = OldMap.
GID64( perm[i] );
176 throw "CrsGraph_AMD::operator(): GlobalIndices type unknown for OldMap";
180 std::cout <<
"Old Map\n";
181 std::cout << OldMap << std::endl;
182 std::cout <<
"New Map\n";
183 std::cout << *
NewMap_ << std::endl;
194 std::cout <<
"New CrsGraph\n";
205 #endif //HAVE_GRAPH_REORDERINGS
206 #endif //HAVE_EXPERIMENTAL
~CrsGraph_AMD()
EpetraExt::CrsGraph_AMD Destructor.
bool GlobalIndicesLongLong() const
long long IndexBase64() const
bool GlobalIndicesInt() const
long long GID64(int LID) const
Epetra_CrsGraph * NewGraph_
const Epetra_Comm & Comm() const
NewTypeRef operator()(OriginalTypeRef orig)
EpetraExt::CrsGraph_AMD Transform Operator.
int Import(const Epetra_SrcDistObject &A, const Epetra_Import &Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)