60 #define MATTRANS_F77 F77_FUNC(mattrans,MATTRANS)
61 #define GENBTF_F77 F77_FUNC(genbtf,GENBTF)
64 extern void MATTRANS_F77(
int*,
int*,
int*,
int*,
int*,
int* );
65 extern void GENBTF_F77(
int*,
int*,
int*,
int*,
int*,
int*,
int*,
int*,
int*,
66 int*,
int*,
int*,
int*,
int*,
int*,
int*,
int*,
int*,
91 for(
int i = 0; i <
Blocks_.size(); ++i )
92 for(
int j = 0; j <
Blocks_[i].size(); ++j )
110 for(
int i = 0; i < numRows; ++i )
115 for(
int j = 0; j < currCnt; ++j )
139 { cout <<
"FAIL for Global!\n"; abort(); }
141 { cout <<
"FAIL for Global Indices!\n"; abort(); }
151 vector<int> ia(n+1,0);
153 vector<int> ja_tmp(maxEntries);
154 vector<double> jva_tmp(maxEntries);
163 for(
int i = 0; i < n; ++i )
168 for(
int j = 0; j < cnt; ++j )
171 ja[ ia[i+1]++ ] = ja_tmp[j];
176 int new_cnt = ia[i+1] - ia[i];
184 cout <<
"Stripped Graph\n";
185 cout << strippedGraph;
188 vector<int> iat(n+1,0);
189 vector<int> jat(nnz);
190 for(
int i = 0; i < n; ++i )
191 for(
int j = ia[i]; j < ia[i+1]; ++j )
193 for(
int i = 0; i < n; ++i )
195 for(
int i = 0; i < n; ++i )
196 for(
int j = ia[i]; j < ia[i+1]; ++j )
197 jat[ iat[ ja[j] ]++ ] = i;
198 for(
int i = 0; i < n; ++i )
199 iat[n-i] = iat[n-i-1];
203 for(
int i = 0; i < n+1; ++i ) ++ia[i];
204 for(
int i = 0; i < nnz; ++i ) ++ja[i];
205 for(
int i = 0; i < n+1; ++i ) ++iat[i];
206 for(
int i = 0; i < nnz; ++i ) ++jat[i];
210 cout <<
"-----------------------------------------\n";
211 cout <<
"CRS Format Graph\n";
212 cout <<
"-----------------------------------------\n";
213 for(
int i = 0; i < n; ++i )
215 cout << i+1 <<
": " << ia[i+1] <<
": ";
216 for(
int j = ia[i]-1; j<ia[i+1]-1; ++j )
217 cout <<
" " << ja[j];
220 cout <<
"-----------------------------------------\n";
225 cout <<
"-----------------------------------------\n";
226 cout <<
"CCS Format Graph\n";
227 cout <<
"-----------------------------------------\n";
228 for(
int i = 0; i < n; ++i )
230 cout << i+1 <<
": " << iat[i+1] <<
": ";
231 for(
int j = iat[i]-1; j<iat[i+1]-1; ++j )
232 cout <<
" " << jat[j];
235 cout <<
"-----------------------------------------\n";
240 vector<int> rowperm(n);
241 vector<int> colperm(n);
244 int nhrows, nhcols, hrzcmp;
248 int nvrows, nvcols, vrtcmp;
250 vector<int> rcmstr(n+1);
251 vector<int> ccmstr(n+1);
256 GENBTF_F77( &n, &n, &iat[0], &jat[0], &ia[0], &ja[0], &w[0],
257 &rowperm[0], &colperm[0], &nhrows, &nhcols,
258 &hrzcmp, &nsrows, &sqcmpn, &nvrows, &nvcols, &vrtcmp,
259 &rcmstr[0], &ccmstr[0], &msglvl, &output );
262 for(
int i = 0; i < n; ++i )
267 for(
int i = 0; (i<n+1) && (rcmstr[i]!=n+1); ++i )
275 cout <<
"-----------------------------------------\n";
276 cout <<
"BTF Output\n";
277 cout <<
"-----------------------------------------\n";
283 cout <<
"Num Horizontal: Rows, Cols, Comps\n";
284 cout << nhrows <<
"\t" << nhcols <<
"\t" << hrzcmp << endl;
286 cout <<
"Num Square: Rows, Comps\n";
287 cout << nsrows <<
"\t" << sqcmpn << endl;
290 cout <<
"Num Vertical: Rows, Cols, Comps\n";
291 cout << nvrows <<
"\t" << nvcols <<
"\t" << vrtcmp << endl;
299 if( hrzcmp || vrtcmp )
301 cout <<
"FAILED! hrz cmp's:" << hrzcmp <<
" vrtcmp: " << vrtcmp << endl;
309 vector<int> rowperm_t( n );
310 vector<int> colperm_t( n );
311 for(
int i = 0; i < n; ++i )
313 rowperm_t[i] = rowperm[i];
314 colperm_t[i] = colperm[i];
322 vector<int> newDomainElements( n );
323 vector<int> newRangeElements( n );
324 for(
int i = 0; i < n; ++i )
333 for(
int i = 0; i < sqcmpn; ++i )
336 for(
int j = rcmstr[i]; j < rcmstr[i+1]; ++j )
360 int MinSize = 1000000000;
362 for(
int i = 0; i < sqcmpn; ++i )
367 cout <<
"Min Block Size: " << MinSize <<
" " <<
"Max Block Size: " << MaxSize << endl;
370 vector<int> myBlockElements( sqcmpn );
371 for(
int i = 0; i < sqcmpn; ++i ) myBlockElements[i] = i;
376 cout <<
"New Block Map!\n";
381 vector< set<int> > crsBlocks( sqcmpn );
384 vector<int> sIndices( maxLength );
386 for(
int i = 0; i < n; ++i )
389 for(
int j = 0; j < currLength; ++j )
393 for(
int i = 0; i < sqcmpn; ++i )
400 for(
int i = 0; i < sqcmpn; ++i )
402 NewBlockRows_[i] = vector<int>( crsBlocks[i].begin(), crsBlocks[i].end() );
415 vector<int> indices( maxLength );
416 vector<double> values( maxLength );
417 for(
int i = 0; i < n; ++i )
422 for(
int j = 0; j < currLength; ++j )
426 for(
int k = 0; k <
BlockCnt_[BlockRow]; ++k )
433 (*(
Blocks_[BlockRow][k]))(SubBlockRow,SubBlockCol) = values[j];
442 NewRHS_->ReplaceGlobalValue( BlockRow, SubBlockRow, 0, (*
OrigRHS_)[0][i] );
447 cout <<
"Zero Elements: \n";
448 cout <<
"--------------\n";
450 for(
int i = 0; i < n; ++i )
454 for( ; iterSI != endSI; ++iterSI )
456 cout <<
" " << *iterSI;
461 cout <<
"ZE Cnt: " << cnt << endl;
462 cout <<
"--------------\n";
467 for(
int i = 0; i < sqcmpn; ++i )
478 cout <<
"New Block Matrix!\n";
480 cout <<
"New Block LHS!\n";
482 cout <<
"New Block RHS!\n";
490 if(
verbose_ ) cout <<
"-----------------------------------------\n";
501 for(
int i = 0; i < NumBlockRows; ++i )
504 for(
int j = 0; j < NumBlocks; ++j )
507 double * p =
Blocks_[i][j]->A();
508 for(
int k = 0; k < Size; ++k ) *p++ = 0.0;
515 vector<int> indices( maxLength );
516 vector<double> values( maxLength );
517 for(
int i = 0; i < n; ++i )
522 for(
int j = 0; j < currLength; ++j )
528 for(
int k = 0; k <
BlockCnt_[BlockRow]; ++k )
531 (*(
Blocks_[BlockRow][k]))(SubBlockRow,SubBlockCol) = values[j];
537 NewRHS_->ReplaceGlobalValue( BlockRow, SubBlockRow, 0, (*
OrigRHS_)[0][i] );
561 for(
int i = 0; i < rowCnt; ++i )
std::map< int, int > SubBlockRowMap_
bool DistributedGlobal() const
Epetra_BlockMap * NewMap_
std::vector< int > BlockCnt_
int ExtractGlobalRowCopy(int_type Row, int Length, int &NumEntries, double *values, int_type *Indices) const
int MyGlobalElements(int *MyGlobalElementList) const
int InsertMyIndices(int LocalRow, int NumIndices, int *Indices)
std::vector< std::vector< int > > NewBlockRows_
Epetra_CrsMatrix * OrigMatrix_
const Epetra_Map & ColMap() const
bool fwd()
Forward transfer of data from orig object input in the operator() method call to the new object creat...
Epetra_MultiVector * NewRHS_
std::vector< std::set< int > > ZeroElements_
int ExtractMyRowView(int MyRow, int &NumEntries, double *&Values, int *&Indices) const
std::vector< int > OldGlobalElements_
const Epetra_Map & RowMap() const
int FirstPointInElement(int LID) const
std::map< int, int > SubBlockColMap_
int MaxNumEntries() const
std::vector< std::vector< Epetra_SerialDenseMatrix * > > Blocks_
std::map< int, int > BlockColMap_
Epetra_VbrMatrix * NewMatrix_
Epetra_MultiVector * OrigRHS_
Epetra_MultiVector * OrigLHS_
NewTypeRef operator()(OriginalTypeRef orig)
Analysis of transform operation on original object and construction of new object.
std::map< int, int > BlockRowMap_
const Epetra_Comm & Comm() const
bool IndicesAreGlobal() const
bool rvs()
Reverse transfer of data from new object created in the operator() method call to the orig object inp...
Epetra_LinearProblem * NewProblem_
std::vector< int > BlockDim_
int MaxNumIndices() const
Epetra_MultiVector * NewLHS_
int ExtractGlobalRowCopy(int_type Row, int LenOfIndices, int &NumIndices, int_type *Indices) const
int ExtractMyRowCopy(int MyRow, int Length, int &NumEntries, double *Values, int *Indices) const
int NumMyNonzeros() const