Ignore:
Timestamp:
03/23/16 16:11:01 (8 years ago)
Author:
mhnguyen
Message:

Refactoring transformation code

+) On exchanging information during transformation, not only global index are sent but also local index
+) Correct a bug in distributed hash table (dht)
+) Add new type for dht
+) Clean up some redundant codes

Test
+) On Curie
+) Every test passes
+) Code runs faster in some cases (up to 30%)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/transformation/axis_algorithm_inverse.cpp

    r827 r829  
    7272  std::map<int, std::vector<double> >& transWeight = this->transformationWeight_[0]; 
    7373 
    74   std::map<size_t, std::vector<std::pair<size_t,double> > > globaIndexMapFromDestToSource; 
     74  CTransformationMapping::DestinationIndexMap globaIndexMapFromDestToSource; 
    7575  std::map<int, std::vector<int> >::const_iterator it = transMap.begin(), ite = transMap.end(); 
     76  int localIndex = 0; 
    7677  for (; it != ite; ++it) 
    7778  { 
    78     globaIndexMapFromDestToSource[it->first].push_back(make_pair((it->second)[0], (transWeight[it->first])[0])); 
     79    globaIndexMapFromDestToSource[it->first].push_back(make_pair(localIndex,make_pair((it->second)[0], (transWeight[it->first])[0]))); 
     80    ++localIndex; 
    7981  } 
    8082 
    8183  transformationMap.computeTransformationMapping(globaIndexMapFromDestToSource); 
    8284 
    83   const std::map<int,std::vector<std::vector<std::pair<size_t,double> > > >& globalIndexToReceive = transformationMap.getGlobalIndexReceivedOnGridDestMapping(); 
    84   const std::map<int,std::vector<size_t> >& globalIndexToSend = transformationMap.getGlobalIndexSendToGridDestMapping(); 
     85  const CTransformationMapping::ReceivedIndexMap& globalIndexToReceive = transformationMap.getGlobalIndexReceivedOnGridDestMapping(); 
     86  const CTransformationMapping::SentIndexMap& globalIndexToSend = transformationMap.getGlobalIndexSendToGridDestMapping(); 
    8587 
    8688 // Sending global index of original grid source 
    87   std::map<int,std::vector<size_t> >::const_iterator itbSend = globalIndexToSend.begin(), itSend, 
    88                                                      iteSend = globalIndexToSend.end(); 
     89  CTransformationMapping::SentIndexMap::const_iterator itbSend = globalIndexToSend.begin(), itSend, 
     90                                                       iteSend = globalIndexToSend.end(); 
    8991 int sendBuffSize = 0; 
    9092 for (itSend = itbSend; itSend != iteSend; ++itSend) sendBuffSize += (itSend->second).size(); 
     
    99101 { 
    100102   int destRank = itSend->first; 
    101    const std::vector<size_t>& globalIndexOfCurrentGridSourceToSend = itSend->second; 
     103   const std::vector<std::pair<int,size_t> >& globalIndexOfCurrentGridSourceToSend = itSend->second; 
    102104   int countSize = globalIndexOfCurrentGridSourceToSend.size(); 
    103105   for (int idx = 0; idx < (countSize); ++idx) 
    104106   { 
    105      int index = globalIndexOfCurrentGridSourceToSend[idx] - ibeginSrc; 
     107     int index = globalIndexOfCurrentGridSourceToSend[idx].first; 
    106108     sendBuff[idx+currentBuffPosition] = (axisSrc_->value)(index); 
    107109   } 
     
    112114 
    113115 // Receiving global index of grid source sending from current grid source 
    114  std::map<int,std::vector<std::vector<std::pair<size_t,double> > > >::const_iterator itbRecv = globalIndexToReceive.begin(), itRecv, 
    115                                                                                      iteRecv = globalIndexToReceive.end(); 
     116 CTransformationMapping::ReceivedIndexMap::const_iterator itbRecv = globalIndexToReceive.begin(), itRecv, 
     117                                                          iteRecv = globalIndexToReceive.end(); 
    116118 int recvBuffSize = 0; 
    117119 for (itRecv = itbRecv; itRecv != iteRecv; ++itRecv) recvBuffSize += (itRecv->second).size(); 
Note: See TracChangeset for help on using the changeset viewer.