Ignore:
Timestamp:
06/19/17 16:00:48 (7 years ago)
Author:
mhnguyen
Message:

Fixing bug: Overlapped domains behave incorrectly

+) If local domains are overlapping on client, the re-constructed domain on server must take care of this overlapped region

Test
+) On Curie
+) test_client, test_complete work
+) Need to test with models

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/src/node/domain.cpp

    r1158 r1173  
    24632463    } 
    24642464     
     2465    globalLocalIndexMap_.rehash(std::ceil(nbIndGlob/globalLocalIndexMap_.max_load_factor())); 
    24652466    i_index.resize(nbIndGlob); 
    2466     j_index.resize(nbIndGlob); 
    2467  
    2468     globalLocalIndexMap_.rehash(std::ceil(nbIndGlob/globalLocalIndexMap_.max_load_factor())); 
     2467    j_index.resize(nbIndGlob);     
    24692468    nbIndGlob = 0; 
    24702469    for (i = 0; i < nbReceived; ++i) 
     
    24742473      { 
    24752474         index = tmp(ind); 
    2476          i_index(nbIndGlob) = index % ni_glo; 
    2477          j_index(nbIndGlob) = index / ni_glo; 
    2478          globalLocalIndexMap_[index] = nbIndGlob;   
    2479          ++nbIndGlob; 
     2475         if (0 == globalLocalIndexMap_.count(index)) 
     2476         { 
     2477           i_index(nbIndGlob) = index % ni_glo; 
     2478           j_index(nbIndGlob) = index / ni_glo; 
     2479           globalLocalIndexMap_[index] = nbIndGlob;   
     2480           ++nbIndGlob; 
     2481         }  
    24802482      }  
    24812483    }  
     2484 
     2485    i_index.resizeAndPreserve(nbIndGlob); 
     2486    j_index.resizeAndPreserve(nbIndGlob); 
    24822487  } 
    24832488 
     
    26302635  void CDomain::recvMask(std::map<int, CBufferIn*>& rankBuffers) 
    26312636  { 
    2632     int nbReceived = rankBuffers.size(), i, ind, index; 
     2637    int nbReceived = rankBuffers.size(), i, ind, index, lInd; 
    26332638    if (nbReceived != recvClientRanks_.size()) 
    2634       ERROR("void CDomain::recvArea(std::map<int, CBufferIn*>& rankBuffers)", 
     2639      ERROR("void CDomain::recvMask(std::map<int, CBufferIn*>& rankBuffers)", 
    26352640           << "The number of sending clients is not correct." 
    26362641           << "Expected number: " << recvClientRanks_.size() << " but received " << nbReceived); 
     
    26502655    } 
    26512656   
     2657    if (nbMaskInd != globalLocalIndexMap_.size()) 
     2658      info (0) << "If the domain " << this->getDomainOutputName() <<" does not have overlapped region between processes." 
     2659               << "Something shouble be wrong with mask index "<< std::endl; 
     2660 
     2661    nbMaskInd = globalLocalIndexMap_.size(); 
    26522662    mask_1d.resize(nbMaskInd); 
    2653     nbMaskInd = 0; 
     2663     
    26542664    for (i = 0; i < nbReceived; ++i) 
    26552665    { 
     2666      CArray<int,1>& tmpInd = indGlob_[recvClientRanks_[i]]; 
    26562667      CArray<bool,1>& tmp = recvMaskValue[i]; 
    26572668      for (ind = 0; ind < tmp.numElements(); ++ind) 
    26582669      { 
    2659         mask_1d(nbMaskInd) = tmp(ind);       
    2660         ++nbMaskInd; 
     2670        lInd = globalLocalIndexMap_[size_t(tmpInd(ind))]; 
     2671        mask_1d(lInd) = tmp(ind); 
    26612672      } 
    26622673    }     
     
    27172728     
    27182729      if (nbLonInd != globalLocalIndexMap_.size()) 
    2719         info (0) << "Something wrong with longitude index "<< std::endl; 
    2720  
     2730        info (0) << "If the domain " << this->getDomainOutputName() <<" does not have overlapped region between processes." 
     2731                 << "Something shouble be wrong with longitude index "<< std::endl; 
     2732 
     2733      nbLonInd = globalLocalIndexMap_.size(); 
    27212734      lonvalue.resize(nbLonInd); 
    27222735      if (hasBounds) 
     
    27992812     
    28002813      if (nbLatInd != globalLocalIndexMap_.size()) 
    2801         info (0) << "Something wrong with latitude index "<< std::endl; 
    2802  
     2814        info (0) << "If the domain " << this->getDomainOutputName() <<" does not have overlapped region between processes." 
     2815                << "Something shouble be wrong with latitude index "<< std::endl; 
     2816 
     2817      nbLatInd = globalLocalIndexMap_.size(); 
    28032818      latvalue.resize(nbLatInd); 
    28042819      if (hasBounds) 
     
    28702885    } 
    28712886 
    2872     int nbAreaInd = 0; 
    2873     for (i = 0; i < nbReceived; ++i) 
    2874     {       
    2875       nbAreaInd += recvAreaValue[i].numElements(); 
    2876     } 
    2877    
    2878     if (nbAreaInd != globalLocalIndexMap_.size()) 
    2879       info (0) << "Something wrong with latitude index "<< std::endl; 
    2880  
    28812887    if (hasArea) 
    28822888    { 
     2889      int nbAreaInd = 0; 
     2890      for (i = 0; i < nbReceived; ++i) 
     2891      {       
     2892        nbAreaInd += recvAreaValue[i].numElements(); 
     2893      } 
     2894 
     2895      if (nbAreaInd != globalLocalIndexMap_.size()) 
     2896        info (0) << "If the domain " << this->getDomainOutputName() <<" does not have overlapped region between processes." 
     2897                 << "Something shouble be wrong with area index "<< std::endl; 
     2898 
     2899      nbAreaInd = globalLocalIndexMap_.size(); 
    28832900      areavalue.resize(nbAreaInd); 
    28842901      nbAreaInd = 0;       
     
    29883005      { 
    29893006         lInd = globalLocalIndexMap_[size_t(tmpInd(ind))]; 
    2990          dataIIndex(lInd) = tmpI(ind); 
    2991          dataJIndex(lInd) = tmpJ(ind);          
     3007         dataIIndex(lInd) = (-1 == dataIIndex(lInd)) ? tmpI(ind) : dataIIndex(lInd); // Only fill in dataIndex if there is no data 
     3008         dataJIndex(lInd) = (-1 == dataJIndex(lInd)) ? tmpJ(ind) : dataJIndex(lInd);          
    29923009      }  
    29933010    } 
Note: See TracChangeset for help on using the changeset viewer.