18 LinearSystemMerger::LinearSystemMerger(
int target_proc_id,
const set<int>& group,
LinearSystem& ls )
19 :_targetID(target_proc_id), _groupID(target_proc_id), _group(group), _ls(ls)
26 LinearSystemMerger::~LinearSystemMerger()
33 LinearSystemMerger::init()
37 _mergeLS = shared_ptr< LinearSystem > (
new LinearSystem() );
41 int key = MPI::COMM_WORLD.Get_rank();
42 _comm = MPI::COMM_WORLD.Split( color, key );
43 _procID = MPI::COMM_WORLD.Get_rank();
44 _totalProcs = _group.size();
46 _totalScatterCells = 0;
47 _totalScatterCellsLocal = 0;
48 _totalGatherCells = 0;
49 _totalGatherCellsLocal = 0;
51 _neighMeshCounts = ArrayIntPtr(
new Array<int>(_totalProcs) ); _neighMeshCounts->zero();
52 _scatterSize = ArrayIntPtr(
new Array<int>(_totalProcs) ); _scatterSize->zero();
53 _gatherSize = ArrayIntPtr(
new Array<int>(_totalProcs) ); _gatherSize->zero();
54 _rowLength = ArrayIntPtr(
new Array<int>(_totalProcs) ); _rowLength->zero();
55 _colLength = ArrayIntPtr(
new Array<int>(_totalProcs) ); _colLength->zero();
56 _selfCounts = ArrayIntPtr(
new Array<int>(_totalProcs) ); _selfCounts->zero();
57 _scatterCells.reserve( _totalProcs );
58 _gatherCells.reserve( _totalProcs );
59 _gatherIDsLocalToGlobalMap.resize( _totalProcs );
61 get_neigh_mesh_counts();
65 get_local_to_global_map();
66 set_merged_crconnectivity();
73 LinearSystemMerger::merge()
85 LinearSystemMerger::get_neigh_mesh_counts()
88 vector<int> siteScatterOffsetLocal;
89 vector<int> siteGatherOffsetLocal;
90 vector<int> scatterMapIDsLocal;
91 vector<int> gatherMapIDsLocal;
98 foreach(
const StorageSite::ScatterMap::value_type& pos, scatterMap ){
102 if ( _group.count( neigh_proc_id ) > 0 ){
104 _totalScatterCellsLocal += fromIndices.
getLength();
105 siteScatterOffsetLocal.push_back( fromIndices.
getLength() );
106 scatterMapIDsLocal.push_back( neigh_proc_id );
113 _comm.Gather( &nmesh, 1, MPI::INT, _neighMeshCounts->getData(), 1, MPI::INT, _targetID );
114 _comm.Gather( &_totalScatterCellsLocal, 1, MPI::INT, _scatterSize->getData(), 1, MPI::INT, _targetID );
120 foreach(
const StorageSite::GatherMap::value_type& pos, gatherMap ){
124 if ( _group.count( neigh_proc_id ) > 0 ){
126 _totalGatherCellsLocal += toIndices.
getLength();
127 siteGatherOffsetLocal.push_back( toIndices.
getLength() );
128 gatherMapIDsLocal.push_back( neigh_proc_id );
134 _comm.Gather( &_totalGatherCellsLocal, 1, MPI::INT, _gatherSize->getData(), 1, MPI::INT, _targetID );
138 for (
int i = 0; i < _neighMeshCounts->getLength(); i++ )
139 _totalInterfaces += (*_neighMeshCounts)[i];
142 ArrayIntPtr scatterInterfaceCounts = ArrayIntPtr(
new Array<int>( _totalInterfaces) );
143 ArrayIntPtr gatherInterfaceCounts = ArrayIntPtr(
new Array<int>( _totalInterfaces) );
144 scatterInterfaceCounts->zero();
145 gatherInterfaceCounts->zero();
148 int displs[ _totalInterfaces ];
151 for (
int i = 1; i < _totalInterfaces; i++ )
152 displs[i] = displs[i-1] + (*_neighMeshCounts)[i-1];
155 _comm.Gatherv( &siteScatterOffsetLocal[0], nmesh, MPI::INT, scatterInterfaceCounts->getData(), &(*_neighMeshCounts)[0], displs, MPI::INT, _targetID );
158 _comm.Gatherv( &siteGatherOffsetLocal[0], nmesh, MPI::INT, gatherInterfaceCounts->getData(), &(*_neighMeshCounts)[0], displs, MPI::INT, _targetID );
162 foreach (
const set<int>::value_type proc, _group ){
163 int num_interfaces = (*_neighMeshCounts)[proc];
164 ArrayIntPtr scatter_counts (
new Array<int> ( num_interfaces ) );
165 ArrayIntPtr gather_counts (
new Array<int> ( num_interfaces ) );
166 for (
int n = 0; n < num_interfaces; n++ ){
167 (*scatter_counts)[n] = (*scatterInterfaceCounts)[indx];
168 (*gather_counts)[n] = (*gatherInterfaceCounts )[indx];
171 _scatterInterfaceCounts[proc] = scatter_counts;
172 _gatherInterfaceCounts[proc] = gather_counts;
175 for (
int i = 0; i < scatterInterfaceCounts->getLength(); i++ )
176 _totalScatterCells += (*scatterInterfaceCounts)[i];
178 for (
int i = 0; i < gatherInterfaceCounts->getLength(); i++ )
179 _totalGatherCells += (*gatherInterfaceCounts)[i];
183 int scatter_recvcnts[_totalProcs];
184 for (
int proc = 0; proc < _totalProcs; proc++ )
185 scatter_recvcnts[proc] = _scatterInterfaceCounts[proc]->getLength();
188 int gather_recvcnts[_totalProcs];
189 for (
int proc = 0; proc < _totalProcs; proc++ )
190 gather_recvcnts[proc] = _gatherInterfaceCounts[proc]->getLength();
192 ArrayIntPtr scatterMapIDs(
new Array<int>( _totalInterfaces) );
195 _comm.Gatherv( &scatterMapIDsLocal[0], nmesh, MPI::INT, scatterMapIDs->getData(), scatter_recvcnts, displs, MPI::INT, _targetID );
198 ArrayIntPtr gatherMapIDs(
new Array<int>( _totalInterfaces) );
200 _comm.Gatherv( &gatherMapIDsLocal[0], nmesh, MPI::INT, gatherMapIDs->getData(), gather_recvcnts, displs, MPI::INT, _targetID );
204 foreach (
const set<int>::value_type proc, _group ){
205 int num_interfaces = (*_neighMeshCounts)[proc];
206 ArrayIntPtr scatterIDs (
new Array<int> ( num_interfaces ) );
207 ArrayIntPtr gatherIDs (
new Array<int> ( num_interfaces ) );
208 for (
int n = 0; n < num_interfaces; n++ ){
209 (*scatterIDs)[n] = (*scatterMapIDs)[indx];
210 (*gatherIDs )[n] = (*gatherMapIDs )[indx];
213 _scatterInterfaceIDs[proc] = scatterIDs;
214 _gatherInterfaceIDs [proc] = gatherIDs;
222 LinearSystemMerger::get_scatter_cells()
228 ArrayIntPtr scatterCellsLocal(
new Array<int> ( _totalScatterCellsLocal ) );
234 foreach(
const StorageSite::ScatterMap::value_type& pos, scatterMap ){
238 if ( _group.count( neigh_proc_id ) > 0 ){
240 for (
int i = 0; i < fromIndices.
getLength(); i++)
241 (*scatterCellsLocal)[indx++] = fromIndices[i];
247 ArrayIntPtr scatterCells(
new Array<int> ( _totalScatterCells) );
250 int displs[ _totalProcs ];
252 for (
int i = 1; i < _totalProcs; i++ )
253 displs[i] = displs[i-1] + (*_scatterSize)[i-1];
257 _comm.Gatherv( scatterCellsLocal->getData(), _totalScatterCellsLocal, MPI::INT,
258 scatterCells->getData(), &(*_scatterSize)[0], displs, MPI::INT, _targetID );
263 foreach (
const set<int>::value_type proc, _group ){
264 const Array<int>& interfaceIDs = *_scatterInterfaceIDs[proc];
265 const Array<int>& interfaceCounts = *_scatterInterfaceCounts[proc];
266 map<int, ArrayIntPtr> cell_map;
267 for (
int i = 0; i < interfaceIDs.
getLength(); i++ ){
268 ArrayIntPtr cells(
new Array<int> ( interfaceCounts[i] ) );
269 for (
int n = 0; n < interfaceCounts[i]; n++ )
270 (*cells)[n] = (*scatterCells)[indx++];
271 int interface_id = interfaceIDs[i];
272 cell_map[interface_id] = cells;
274 _scatterCells.push_back( cell_map );
283 LinearSystemMerger::get_gather_cells()
287 ArrayIntPtr gatherCellsLocal(
new Array<int> ( _totalGatherCellsLocal ) );
293 foreach(
const StorageSite::GatherMap::value_type& pos, gatherMap ){
297 if ( _group.count( neigh_proc_id ) > 0 ){
299 for (
int i = 0; i < toIndices.
getLength(); i++ )
300 (*gatherCellsLocal)[indx++] = toIndices[i];
306 ArrayIntPtr gatherCells (
new Array<int> ( _totalGatherCells ) );
308 int displs[ _totalProcs ];
310 for (
int i = 1; i < _totalProcs; i++ )
311 displs[i] = displs[i-1] + (*_gatherSize)[i-1];
314 _comm.Gatherv( gatherCellsLocal->getData(), _totalGatherCellsLocal, MPI::INT,
315 gatherCells->getData(), &(*_gatherSize)[0], displs, MPI::INT, _targetID );
319 foreach (
const set<int>::value_type proc, _group ){
320 const Array<int>& interfaceIDs = *_gatherInterfaceIDs[proc];
321 const Array<int>& interfaceCounts = *_gatherInterfaceCounts[proc];
322 map<int, ArrayIntPtr> cell_map;
323 for (
int i = 0; i < interfaceIDs.
getLength(); i++ ){
324 ArrayIntPtr cells(
new Array<int> ( interfaceCounts[i] ) );
325 for (
int n = 0; n < interfaceCounts[i]; n++ )
326 (*cells)[n] = (*gatherCells)[indx++];
328 int interface_id = interfaceIDs[i];
329 cell_map[interface_id] = cells;
331 _gatherCells.push_back( cell_map );
340 LinearSystemMerger::get_crconnectivity()
345 const CRConnectivity& conn = _ls.getMatrix().getMatrix( k, k).getConnectivity();
350 _comm.Gather( &rowLength , 1, MPI::INT, _rowLength->getData() , 1, MPI::INT, _targetID );
351 _comm.Gather( &colLength , 1, MPI::INT, _colLength->getData() , 1, MPI::INT, _targetID );
352 _comm.Gather( &inner_cells, 1, MPI::INT, _selfCounts->getData(), 1, MPI::INT, _targetID );
359 for (
int i = 0; i < _totalProcs; i++ ){
360 row_size += (*_rowLength)[i];
361 col_size += (*_colLength)[i];
366 ArrayIntPtr row(
new Array<int> ( row_size ) );
367 ArrayIntPtr col(
new Array<int> ( col_size ) );
369 int displs_row[ _totalProcs ];
370 int displs_col[ _totalProcs ];
373 for (
int i = 1; i < _totalProcs; i++ ){
374 displs_row[i] = displs_row[i-1] + (*_rowLength)[i-1];
375 displs_col[i] = displs_col[i-1] + (*_colLength)[i-1];
381 const CRConnectivity& conn = _ls.getMatrix().getMatrix( k, k).getConnectivity();
386 _comm.Gatherv( row_local.
getData(), rowLength, MPI::INT, row->getData(), &(*_rowLength)[0], displs_row, MPI::INT, _targetID );
387 _comm.Gatherv( col_local.
getData(), colLength, MPI::INT, col->getData(), &(*_colLength)[0], displs_col, MPI::INT, _targetID );
395 foreach (
const set<int>::value_type proc_id, _group ){
396 _row[proc_id] = ArrayIntPtr (
new Array<int> ( (*_rowLength)[local] ) );
397 _col[proc_id] = ArrayIntPtr (
new Array<int> ( (*_colLength)[local] ) );
404 foreach (
const set<int>::value_type proc_id, _group ){
405 for (
int i = 0; i < (*_rowLength)[local]; i++ )
406 (*_row[proc_id])[i] = (*row)[indx++];
412 foreach (
const set<int>::value_type proc_id, _group ){
413 for (
int i = 0; i < (*_colLength)[local]; i++ )
414 (*_col[proc_id])[i] = (*col)[indx++];
435 LinearSystemMerger::get_local_to_global_map()
441 foreach (
const set<int>::value_type proc_id, _group){
442 _localToGlobal[proc_id] = ArrayIntPtr(
new Array<int> ( (*_selfCounts)[indx] ) );
443 _totalCells += (*_selfCounts)[indx];
447 _globalToProc = ArrayIntPtr(
new Array<int> ( _totalCells ) );
448 _globalToLocal = ArrayIntPtr(
new Array<int> ( _totalCells ) );
452 foreach (
const set<int>::value_type proc_id, _group ){
453 for (
int n = 0; n < (*_selfCounts)[indx]; n++ ){
454 (*_localToGlobal[proc_id])[n] = global_id;
455 (*_globalToProc )[global_id] = proc_id;
456 (*_globalToLocal)[global_id] = n;
468 LinearSystemMerger::set_merged_crconnectivity()
474 _siteMerger = shared_ptr< StorageSiteMerger > (
new StorageSiteMerger( _targetID, _group, cell_site) );
478 _site = _siteMerger->merge();
479 update_gatherCells_from_scatterCells();
481 _mergeCR = shared_ptr< CRConnectivity > (
new CRConnectivity(*_site, *_site) );
483 _mergeCR->initCount();
487 foreach ( set<int>::value_type proc, _group ){
490 const map<int,int>& gatherIDsLocalToGlobal = _gatherIDsLocalToGlobalMap[proc];
493 int ghost_startID = ghost_endID - int( gatherIDsLocalToGlobal.size() );
494 int selfCount = (*_selfCounts)[proc];
497 for (
int i = 0; i < selfCount; i++ ){
498 int count = row[i+1] - row[i];
500 for (
int j = 0; j < count; j++){
501 int localID = col[ row[i]+j ];
503 if ( !(localID >= selfCount && localID < ghost_startID) )
504 _mergeCR->addCount( indx, 1 );
511 _mergeCR->finishCount();
515 foreach ( set<int>::value_type proc, _group ){
518 const Array<int>& localToGlobal = *_localToGlobal[proc];
519 const map<int,int>& gatherIDsLocalToGlobal = _gatherIDsLocalToGlobalMap[proc];
522 int ghost_startID = ghost_endID - int( gatherIDsLocalToGlobal.size() );
523 int selfCount = (*_selfCounts)[proc];
526 for (
int i = 0; i < selfCount; i++ ){
527 int count = row[i+1] - row[i];
529 for (
int j = 0; j < count; j++ ){
530 int localID = col[ row[i]+j ];
533 if ( localID < selfCount ){
534 globalID = localToGlobal[ localID ];
536 globalID = gatherIDsLocalToGlobal.find(localID)->second;
540 if ( !(localID >= selfCount && localID < ghost_startID) )
541 _mergeCR->add( indx, globalID );
547 _mergeCR->finishAdd();
564 LinearSystemMerger::update_gatherCells_from_scatterCells()
569 foreach ( set<int>::value_type proc, _group ){
570 const Array<int>& gatherInterfaceIDs = *_gatherInterfaceIDs[proc];
573 for (
int n = 0; n < gatherInterfaceIDs.
getLength(); n++ ){
574 int neighMeshID = gatherInterfaceIDs[n];
575 const Array<int>& gatherCells = *_gatherCells [proc][neighMeshID];
576 const Array<int>& scatterCells = *_scatterCells[neighMeshID][proc];
578 for (
int i = 0; i < gatherCells.
getLength(); i++ ){
579 int cellID = (*_localToGlobal[neighMeshID])[ scatterCells[i] ];
580 int gatherID = gatherCells[i];
581 _gatherIDsLocalToGlobalMap[proc][ gatherID ] = cellID;
594 LinearSystemMerger::update_col()
597 foreach( set<int>::value_type proc_id, _group ){
600 const map<int,int>& gatherIDsLocalToGLobal = _gatherIDsLocalToGlobalMap[proc_id];
603 int ghost_startID = ghost_endID - int( gatherIDsLocalToGLobal.size() );
604 int selfCount = (*_selfCounts)[proc_id];
606 for (
int i = 0; i < col.
getLength(); i++ ){
608 if ( col[i] >= ghost_startID && col[i] <= ghost_endID )
609 col[i] = gatherIDsLocalToGLobal.find( col[i] )->second;
612 if( col[i] >= selfCount && col[i] < ghost_startID ){
624 LinearSystemMerger::set_ls_vectors()
626 _mergeLS->_b = shared_ptr<MultiField> (
new MultiField() );
634 _mergeLS->_b->addArray( mergeIndex, delta[ai].newSizedClone( mergeSite.
getCount()) );
643 _mergeLS->_b->zero();
644 _mergeLS->_delta = dynamic_pointer_cast<
MultiField> ( _mergeLS->_b->newClone() );
645 _mergeLS->_delta->
zero();
646 _mergeLS->_residual = dynamic_pointer_cast<
MultiField> ( _mergeLS->_b->newClone() );
647 _mergeLS->_residual->
zero();
656 LinearSystemMerger::gatherMatrix()
666 int send_buffer = _ls.getMatrix().getMatrix(k,k).getDiagDataSize();
667 _comm.Gather( &send_buffer , 1, MPI::INT, sizeDiag.getData(), 1, MPI::INT, _targetID );
668 send_buffer = _ls.getMatrix().getMatrix(k,k).getOffDiagDataSize();
669 _comm.Gather( &send_buffer , 1, MPI::INT, sizeOffDiag.getData(), 1, MPI::INT, _targetID );
674 int size_offdiag = 0;
675 foreach ( set<int>::value_type proc, _group ){
676 sizeDiag[proc] = sizeDiag[proc] /
sizeof( double );
677 sizeOffDiag[proc] = sizeOffDiag[proc] /
sizeof( double );
678 size_diag += sizeDiag[proc];
679 size_offdiag += sizeOffDiag[proc];
683 int displs_diag[ _totalProcs ];
684 int displs_offdiag[ _totalProcs ];
686 displs_offdiag[0] = 0;
687 for (
int i = 1; i < _totalProcs; i++ ){
688 displs_diag[i] = displs_diag[i-1] + sizeDiag[i-1];
689 displs_offdiag[i] = displs_offdiag[i-1] + sizeOffDiag[i-1];
719 int send_cnts_diag = _ls.getMatrix().getMatrix(k,k).getDiagDataSize();
720 _comm.Gatherv( _ls.getMatrix().getMatrix(k,k).getDiagData(), send_cnts_diag, MPI::BYTE, diag->getData(), &sizeDiag[0], displs_diag, MPI::DOUBLE, _targetID );
721 int send_cnts_offdiag = _ls.getMatrix().getMatrix(k,k).getOffDiagDataSize();
722 _comm.Gatherv( _ls.getMatrix().getMatrix(k,k).getOffDiagData(), send_cnts_offdiag, MPI::BYTE, offdiag->getData(), &sizeOffDiag[0], displs_offdiag, MPI::DOUBLE, _targetID );
727 foreach (
const set<int>::value_type proc_id, _group){
728 _diag[proc_id] = ArrayDblePtr(
new Array<double> ( sizeDiag[proc_id] ) );
731 for (
int i = 0; i < sizeDiag[proc_id]; i++ ){
732 diagonal[i] = (*diag)[indx];
738 foreach (
const set<int>::value_type proc_id, _group){
739 _offDiag[proc_id] = ArrayDblePtr(
new Array<double> ( sizeOffDiag[proc_id] ) );
742 for (
int i = 0; i < sizeOffDiag[proc_id]; i++ ){
743 offDiagonal[i] = (*offdiag)[indx];
751 MultiField& mergeMultiField = _mergeLS->getDelta();
754 Matrix& mIJ = _ls.getMatrix().getMatrix( k, k );
755 _mergeLS->getMatrix().addMatrix( mergeIndex, mergeIndex , mIJ.
createMergeMatrix( *
this) );
766 LinearSystemMerger::gatherB()
769 int displs[ _totalProcs ];
771 for (
int i = 1; i < _totalProcs; i++ ){
772 displs[i] = displs[i-1] + (*_selfCounts)[i-1];
779 MultiField& mergeMultiField = _mergeLS->getB();
780 _mergeLS->getDelta().
zero();
791 ArrayBase& mergeB = mergeMultiField[mergerIndex];
792 _comm.Gatherv( B.
getData(), send_cnts, MPI::DOUBLE, mergeB.
getData(), &(*_selfCounts)[0], displs, MPI::DOUBLE, _targetID );
800 LinearSystemMerger::scatterDelta()
802 MPI::COMM_WORLD.Barrier();
803 int displs[ _totalProcs ];
805 for (
int i = 1; i < _totalProcs; i++ )
806 displs[i] = displs[i-1] + (*_selfCounts)[i-1];
816 const MultiField& mergeMultiField = _mergeLS->getDelta();
818 const ArrayBase& mergeDelta = mergeMultiField[mergerIndex];
819 _comm.Scatterv( mergeDelta.
getData(), &(*_selfCounts)[0], displs, MPI::DOUBLE, delta.
getData(), recv_cnts, MPI::DOUBLE, _targetID );
834 LinearSystemMerger::debug_print()
837 if ( _procID == _targetID ){
839 ss <<
"proc" << MPI::COMM_WORLD.Get_rank() <<
"_linear_system_merger.dat";
840 ofstream debug_file( (ss.str()).c_str() );
844 for (
int n = 0; n < _totalProcs; n++ )
845 debug_file <<
" _neighMeshCounts[" << n <<
"] = " << (*_neighMeshCounts)[n] << endl;
849 for (
int n = 0; n < _totalProcs; n++ )
850 debug_file <<
" _scatterSize[" << n <<
"] = " << (*_scatterSize)[n] << endl;
854 for (
int n = 0; n < _totalProcs; n++ )
855 debug_file <<
" _gatherSize[" << n <<
"] = " << (*_gatherSize)[n] << endl;
859 debug_file <<
" _totalInterfaces = " << _totalInterfaces << endl;
863 debug_file <<
" _totalScatterCells = " << _totalScatterCells << endl;
867 debug_file <<
" _totalGatherCells = " << _totalGatherCells << endl;
872 foreach ( set<int>::value_type proc, _group ){
873 debug_file <<
"procID : " << proc << endl;
874 const Array<int>& scatter_counts = *_scatterInterfaceCounts[proc];
875 const Array<int>& gather_counts = *_gatherInterfaceCounts[proc];
876 for (
int n = 0; n < scatter_counts.
getLength(); n++ )
877 debug_file <<
" scatter_counts[" << n <<
"] = " << scatter_counts[n] << endl;
880 for (
int n = 0; n < gather_counts.
getLength(); n++ )
881 debug_file <<
" gather_counts[" << n <<
"] = " << gather_counts[n] << endl;
888 foreach ( set<int>::value_type proc, _group ){
889 debug_file <<
"procID : " << proc << endl;
890 const Array<int>& scatterInterfaceIDs = *_scatterInterfaceIDs[proc];
891 for (
int n = 0; n < scatterInterfaceIDs.
getLength(); n++ )
892 debug_file <<
" scatterInterfaceIDs[" << n <<
"] = " << scatterInterfaceIDs[n] << endl;
898 foreach ( set<int>::value_type proc, _group ){
899 debug_file <<
"procID : " << proc << endl;
901 const map<int, ArrayIntPtr>& cell_map = _scatterCells[proc];
902 foreach (
const ArrayIntPtrMap::value_type& pos, cell_map ){
903 debug_file <<
" scatterID = " << pos.first << endl;
904 for (
int n = 0; n < pos.second->getLength(); n++ )
905 debug_file <<
" " << (*pos.second)[n] << endl;
913 foreach ( set<int>::value_type proc, _group ){
914 debug_file <<
"procID : " << proc << endl;
915 const Array<int>& gatherInterfaceIDs = *_gatherInterfaceIDs[proc];
916 for (
int n = 0; n < gatherInterfaceIDs.
getLength(); n++ )
917 debug_file <<
" gatherInterfaceIDs[" << n <<
"] = " << gatherInterfaceIDs[n] << endl;
922 foreach ( set<int>::value_type proc, _group ){
923 debug_file <<
"procID : " << proc << endl;
925 const map<int, ArrayIntPtr>& cell_map = _gatherCells[proc];
926 foreach (
const ArrayIntPtrMap::value_type& pos, cell_map ){
927 debug_file <<
" gatherID = " << pos.first << endl;
928 for (
int n = 0; n < pos.second->getLength(); n++ )
929 debug_file <<
" " << (*pos.second)[n] << endl;
936 debug_file <<
" _rowLength : " << endl;
937 for (
int n = 0; n < _rowLength->getLength(); n++ )
938 debug_file <<
" _rowLength[ " << n <<
"] = " << (*_rowLength)[n] << endl;
941 debug_file <<
" _colLength : " << endl;
942 for (
int n = 0; n < _colLength->getLength(); n++ )
943 debug_file <<
" _colLength[ " << n <<
"] = " << (*_colLength)[n] << endl;
946 debug_file <<
" _selfCounts : " << endl;
947 for (
int n = 0; n < _selfCounts->getLength(); n++ )
948 debug_file <<
" _selfCounts[ " << n <<
"] = " << (*_selfCounts)[n] << endl;
952 foreach ( set<int>::value_type proc, _group ){
953 debug_file <<
"procID : " << proc << endl;
956 for (
int i = 0; i < row.
getLength()-1; i++ ){
957 int col_dim = row[i+1] - row[i];
958 for (
int j = 0; j < col_dim; j++ ){
959 debug_file <<
" coarseCR(" << i <<
"," << j <<
") = " << col[ row[i]+j ] << endl;
967 foreach ( set<int>::value_type proc, _group ){
968 debug_file <<
"procID: " << proc << endl;
969 for (
int n = 0; n < (*_selfCounts)[indx]; n++ )
970 debug_file <<
"localToGlobal[" << n <<
"] = " << (*_localToGlobal[proc])[n] << endl;
976 for (
int n = 0; n < _totalCells; n++ )
977 debug_file <<
"_globalToLocal[" << n <<
"] = " << (*_globalToLocal)[n] <<
" resides at procID = " << (*_globalToProc)[n] << endl;
981 foreach ( set<int>::value_type proc, _group ){
982 debug_file <<
"procID (global numbering) : " << proc << endl;
984 const map<int, ArrayIntPtr>& cell_map = _gatherCells[proc];
985 foreach (
const ArrayIntPtrMap::value_type& pos, cell_map ){
986 debug_file <<
" gatherID = " << pos.first << endl;
987 for (
int n = 0; n < pos.second->getLength(); n++ )
988 debug_file <<
" " << (*pos.second)[n] << endl;
995 int row_dim = _mergeCR->getRowDim();
996 for (
int i = 0; i < row_dim; i++ ){
997 int col_dim = _mergeCR->getCount(i);
998 for (
int j = 0; j < col_dim; j++ ){
999 debug_file <<
" mergeCR(" << i <<
"," << j <<
") = " << (*_mergeCR)(i,j) << endl;
1007 const Array<int>& mergeCol = _mergeCR->getCol();
1008 for (
int i = 0; i < mergeCol.
getLength(); i++ )
1009 debug_file <<
" mergeCol(" << i <<
") = " << mergeCol[i] << endl;
1020 const MultiField& multiField = _mergeLS->getDelta();
1022 for (
int i = 0; i < delta.
getLength(); i++ )
1023 debug_file <<
" delta(" << i <<
") = " << delta[i] << endl;
1028 foreach ( set<int>::value_type proc, _group ){
1029 debug_file <<
"procID : " << proc << endl;
1031 for (
int n = 0; n < diag.
getLength(); n++ )
1032 debug_file <<
" diag[" << n <<
"] = " << diag[n] << endl;
1038 foreach ( set<int>::value_type proc, _group ){
1039 debug_file <<
"procID : " << proc << endl;
1041 for (
int n = 0; n < offDiag.
getLength(); n++ )
1042 debug_file <<
" offDiag[" << n <<
"] = " << offDiag[n] << endl;
const Array< int > & getCol() const
const Array< int > & getRow() const
virtual void * getData() const
pair< const Field *, const StorageSite * > ArrayIndex
int getGatherProcID() const
vector< ArrayIndex > ArrayIndexList
const ScatterMap & getScatterMap() const
map< const StorageSite *, shared_ptr< Array< int > > > ScatterMap
const GatherMap & getGatherMap() const
const ArrayIndexList & getArrayIndices() const
virtual void * getData() const =0
map< const StorageSite *, shared_ptr< Array< int > > > GatherMap
virtual shared_ptr< Matrix > createMergeMatrix(const LinearSystemMerger &mergeLS)
const StorageSite & getRowSite() const
const ArrayIndex getArrayIndex(const int i) const