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/domain_algorithm_transformation.cpp

    r827 r829  
    4242                                                                          const std::vector<int>& gridDestGlobalDim, 
    4343                                                                          const std::vector<int>& gridSrcGlobalDim, 
    44                                                                           const std::vector<size_t>& globalIndexGridDestSendToServer, 
    45                                                                           CArray<size_t,1>& globalIndexDestGrid, 
     44                                                                          const GlobalLocalMap& globalLocalIndexDestSendToServerMap, 
     45                                                                          std::vector<std::pair<size_t,int> >& globalLocalIndexDestMap, 
    4646                                                                          std::vector<std::vector<size_t> >& globalIndexSrcGrid) 
    4747{ 
     
    7979  for (int i = 0; i< numElement; ++i) ssize *= gridDomainGlobalDim[i]; 
    8080 
    81   std::vector<size_t>::const_iterator itbArr = globalIndexGridDestSendToServer.begin(), itArr, 
    82                                       iteArr = globalIndexGridDestSendToServer.end(); 
     81  GlobalLocalMap::const_iterator iteArr = globalLocalIndexDestSendToServerMap.end(), it; 
     82 
    8383  idx = 0; 
    8484  while (idx < ssize) 
     
    112112    } 
    113113 
    114     if (std::binary_search(itbArr, iteArr, globIndex)) ++realGlobalIndexSize; 
     114    if (iteArr != globalLocalIndexDestSendToServerMap.find(globIndex)) ++realGlobalIndexSize; 
    115115    ++idxLoop[0]; 
    116116    ++idx; 
    117117  } 
    118118 
    119   if (globalIndexDestGrid.numElements() != realGlobalIndexSize) 
    120     globalIndexDestGrid.resize(realGlobalIndexSize); 
     119  if (globalLocalIndexDestMap.size() != realGlobalIndexSize) 
     120    globalLocalIndexDestMap.resize(realGlobalIndexSize); 
    121121 
    122122  if (realGlobalIndexSize != globalIndexSrcGrid.size()) globalIndexSrcGrid.resize(realGlobalIndexSize); 
     
    158158    } 
    159159 
    160     if (std::binary_search(itbArr, iteArr, globIndex)) 
     160    it = globalLocalIndexDestSendToServerMap.find(globIndex); 
     161    if (iteArr != it) 
    161162    { 
    162       globalIndexDestGrid(realGlobalIndex) = globIndex; 
     163      globalLocalIndexDestMap[realGlobalIndex] = (std::make_pair(it->first,it->second)); 
    163164      for (int i = 0; i < globalIndexSrcGrid[realGlobalIndex].size(); ++i) 
    164165      { 
Note: See TracChangeset for help on using the changeset viewer.