15 StorageSiteMerger::StorageSiteMerger(
int target_proc_id,
const set<int>& group,
const StorageSite& cell_site )
16 :_groupID(target_proc_id), _group(group), _cellSite(cell_site), _mergeSiteSize(0), _mergeSiteGhostSize(0)
21 StorageSiteMerger::~StorageSiteMerger()
28 StorageSiteMerger::init()
32 int key = MPI::COMM_WORLD.Get_rank();
33 _comm = MPI::COMM_WORLD.Split( color, key );
37 shared_ptr<StorageSite>
38 StorageSiteMerger::merge()
40 StorageSite::GatherMap::const_iterator it;
41 int tot_adjacent_count = 0;
43 for ( it = _cellSite.getGatherMap().begin(); it != _cellSite.getGatherMap().end(); it++){
47 if ( _group.count( gatherID) > 0 ){
48 int interface_count =it->second->getLength();
49 tot_adjacent_count += interface_count;
54 int local_size = _cellSite.getCount() - tot_adjacent_count;
55 int ghost_size = local_size - _cellSite.getSelfCount();
56 int self_size = _cellSite.getSelfCount();
58 _comm.Reduce( &self_size , &_mergeSiteSize , 1, MPI::INT, MPI::SUM, _groupID );
59 _comm.Reduce( &ghost_size, &_mergeSiteGhostSize, 1, MPI::INT, MPI::SUM, _groupID );
61 return shared_ptr<StorageSite> (
new StorageSite(_mergeSiteSize) );
67 StorageSiteMerger::debug_print()
69 shared_ptr<StorageSite> tempSite = merge();
71 ss <<
"proc" << MPI::COMM_WORLD.Get_rank() <<
"_storage_site_merger.dat";
72 ofstream debug_file( (ss.str()).c_str() );
74 debug_file <<
" selfCount = " << _mergeSiteSize << endl;
75 debug_file <<
" GhostCount = " << _mergeSiteGhostSize << endl;
76 debug_file <<
" count = " << _mergeSiteSize + _mergeSiteGhostSize << endl;
int getGatherProcID() const