Ignore:
Timestamp:
11/05/18 13:57:52 (6 years ago)
Author:
oabramkina
Message:

Backporting r1578 and r1586 to dev, cleaning the code before merging it to XIOS 2.5.

Location:
XIOS/dev/dev_olga/src/node
Files:
5 edited

Legend:

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

    r1576 r1589  
    696696    CArray<size_t,1>::const_iterator itSrvb = writtenGlobalIndex.begin(), 
    697697                                     itSrve = writtenGlobalIndex.end(), itSrv;   
    698 //    for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 
    699 //    { 
    700 //      indGlo = *itSrv; 
    701 //      if (ite != globalLocalIndexMap_.find(indGlo)) 
    702 //      { 
    703 //        ++nbWritten; 
    704 //      } 
    705 //    } 
    706698 
    707699    localIndexToWriteOnServer.resize(writtenGlobalIndex.numElements()); 
    708 //    localIndexToWriteOnServer.resize(nbWritten); 
    709  
    710700    nbWritten = 0; 
    711701    for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 
     
    10331023      list<CMessage> listData; 
    10341024      list<CArray<int,1> > list_indi, list_dataInd; 
    1035       list<CArray<bool,1> > list_mask; 
    10361025      list<CArray<double,1> > list_val; 
    10371026      list<CArray<double,2> > list_bounds; 
     
    10601049        list_indi.push_back(CArray<int,1>(nbData)); 
    10611050        list_dataInd.push_back(CArray<int,1>(nbData)); 
    1062         list_mask.push_back(CArray<bool,1>(nbData)); 
    10631051 
    10641052        if (hasValue) 
     
    10741062        CArray<int,1>& dataIndi = list_dataInd.back(); 
    10751063        dataIndi = -1; 
    1076         CArray<bool,1>& maskIndi = list_mask.back(); 
    10771064 
    10781065        for (int n = 0; n < nbData; ++n) 
     
    10831070          ind = globalLocalIndexMap_[idx]; 
    10841071          dataIndi(n) = dataIndex(ind); 
    1085 //          maskIndi(n) = mask(ind); 
    10861072 
    10871073          if (hasValue) 
     
    11071093        listData.push_back(CMessage()); 
    11081094        listData.back() << this->getId() 
    1109                         << list_indi.back() << list_dataInd.back(); //<< list_mask.back(); 
     1095                        << list_indi.back() << list_dataInd.back(); 
    11101096 
    11111097        listData.back() << hasValue; 
     
    11681154      buffer >> vec_indi[idx]; 
    11691155      buffer >> vec_dataInd[idx];       
    1170 //      buffer >> vec_mask[idx]; 
    11711156 
    11721157      buffer >> hasValue; 
     
    12051190         if (0 == globalLocalIndexMap_.count(gloInd)) 
    12061191         { 
    1207 //           index(nbIndLoc) = gloInd % n_glo; 
    1208 //           globalLocalIndexMap_[gloInd] = nbIndLoc; 
    1209 //           ++nbIndexGlob; 
    12101192           index(nbIndexGlob) = gloInd % n_glo; 
    12111193           globalLocalIndexMap_[gloInd] = nbIndexGlob; 
     
    12221204    CArray<int,1> nonCompressedData(nbData); 
    12231205    nonCompressedData = -1;    
    1224 //    mask.resize(nbData); 
    1225 //    mask = true; 
    12261206    // Mask is incorporated into data_index and is not sent/received anymore 
    12271207    mask.resize(0); 
     
    12381218      CArray<int,1>& indi = vec_indi[idx]; 
    12391219      CArray<int,1>& dataIndi = vec_dataInd[idx]; 
    1240 //      CArray<bool,1>& maskIndi = vec_mask[idx]; 
    12411220      int nb = indi.numElements(); 
    12421221      for (int n = 0; n < nb; ++n) 
     
    12461225        nonCompressedData(locInd) = (-1 == nonCompressedData(locInd)) ? dataIndi(n) : nonCompressedData(locInd); 
    12471226 
    1248 //        if (!mask(locInd)) // Only rewrite mask if it's not true 
    1249 //          mask(locInd) = maskIndi(n); 
    1250          
    12511227        if (hasValue) 
    12521228          value(locInd) = vec_val[idx](n); 
  • XIOS/dev/dev_olga/src/node/axis.hpp

    r1571 r1589  
    114114         void computeWrittenIndex(); 
    115115         void computeWrittenCompressedIndex(MPI_Comm); 
    116  
    117          template <class T> void outputAxis(CArray<T,1>& valueIn, CArray<T,1>& valueOut); 
    118  
    119116         bool hasTransformation(); 
    120117         void solveInheritanceTransformation(); 
     
    129126        bool hasLabel; 
    130127 
    131 //        CArray<size_t,1> localIndexToWriteOnServer; 
    132128        CArray<int,1> localIndexToWriteOnServer; 
    133         CArray<size_t,1> localIndexToWriteOnClient; 
    134129 
    135130      private: 
     
    188183   }; // class CAxis 
    189184 
    190    ///-------------------------------------------------------------- 
    191  
    192    template <class T> void CAxis::outputAxis(CArray<T,1>& valueIn, CArray<T,1>& valueOut) 
    193    { 
    194      int sizeServer = localIndexToWriteOnServer.numElements(); 
    195      int sizeClient = localIndexToWriteOnClient.numElements(); 
    196      valueOut.resize(sizeClient); 
    197  
    198      if (sizeServer == sizeClient) 
    199      { 
    200        valueOut = valueIn; 
    201      } 
    202      else 
    203      // a hole 
    204      { 
    205        valueOut = valueIn; 
    206        //valueOut = -1; initialize here to some value ???? 
    207      } 
    208 //      CArray<size_t,1>& outIndexClient = grid->localIndexToWriteOnClient; 
    209 //      CArray<size_t,1>& outIndexServer = grid->localIndexToWriteOnServer; 
    210 //      for (size_t idx = 0; idx < outIndexServer.numElements(); ++idx) 
    211 //      { 
    212 //        fieldOut(outIndexServer(idx)) = recvDataSrv(outIndexClient(idx)); 
    213 //      } 
    214    } 
    215  
    216185   // Declare/Define CAxisGroup and CAxisDefinition 
    217186   DECLARE_GROUP(CAxis); 
  • XIOS/dev/dev_olga/src/node/domain.cpp

    r1576 r1589  
    3333      , lonvalue(), latvalue(), bounds_lonvalue(), bounds_latvalue() 
    3434      , globalLocalIndexMap_(), computedWrittenIndex_(false) 
    35       , clients() 
     35      , clients(), hasLatInReadFile_(false), hasBoundsLatInReadFile_(false) 
     36      , hasLonInReadFile_(false), hasBoundsLonInReadFile_(false) 
    3637   { 
    3738   } 
     
    4546      , lonvalue(), latvalue(), bounds_lonvalue(), bounds_latvalue() 
    4647      , globalLocalIndexMap_(), computedWrittenIndex_(false) 
    47       , clients() 
     48      , clients(), hasLatInReadFile_(false), hasBoundsLatInReadFile_(false) 
     49      , hasLonInReadFile_(false), hasBoundsLonInReadFile_(false) 
    4850   { 
    4951    } 
     
    161163       // size estimation for sendIndex (and sendArea which is always smaller or equal) 
    162164       size_t sizeIndexEvent = 2 * sizeof(size_t) + 2 * CArray<int,1>::size(idxCount); 
    163        // if (isCompressible_) 
    164        // { 
    165        //   std::map<int, std::vector<int> >::const_iterator itWritten = indWrittenSrv_.find(rank); 
    166        //   size_t writtenIdxCount = (itWritten != itWrittenIndexEnd) ? itWritten->second.size() : 0; 
    167        //   sizeIndexEvent += CArray<int,1>::size(writtenIdxCount); 
    168        // } 
    169165 
    170166       // size estimation for sendLonLat 
     
    19081904                                       itSrve = writtenGlobalIndex.end(), itSrv; 
    19091905 
    1910 //      for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 
    1911 //      { 
    1912 //        indGlo = *itSrv; 
    1913 //        if (ite != globalLocalIndexMap_.find(indGlo)) 
    1914 //        { 
    1915 //          ++nbWritten; 
    1916 //        } 
    1917 //      } 
    1918  
    1919 //      localIndexToWriteOnServer.resize(nbWritten); 
    19201906      localIndexToWriteOnServer.resize(writtenGlobalIndex.numElements()); 
    1921  
    19221907      nbWritten = 0; 
    19231908      for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 
     
    19341919        ++nbWritten; 
    19351920      } 
    1936        
    1937       // if (isCompressible()) 
    1938       // { 
    1939       //   nbWritten = 0; 
    1940       //   std::unordered_map<size_t,size_t> localGlobalIndexMap; 
    1941       //   for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 
    1942       //   { 
    1943       //     indGlo = *itSrv; 
    1944       //     if (ite != globalLocalIndexMap_.find(indGlo)) 
    1945       //     { 
    1946       //       localGlobalIndexMap[localIndexToWriteOnServer(nbWritten)] = indGlo; 
    1947       //       ++nbWritten; 
    1948       //     }                  
    1949       //   } 
    1950  
    1951       //   nbWritten = 0; 
    1952       //   for (int idx = 0; idx < data_i_index.numElements(); ++idx) 
    1953       //   { 
    1954       //     if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_i_index(idx))) 
    1955       //     { 
    1956       //       ++nbWritten; 
    1957       //     } 
    1958       //   } 
    1959  
    1960       //   compressedIndexToWriteOnServer.resize(nbWritten); 
    1961       //   nbWritten = 0; 
    1962       //   for (int idx = 0; idx < data_i_index.numElements(); ++idx) 
    1963       //   { 
    1964       //     if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_i_index(idx))) 
    1965       //     { 
    1966       //       compressedIndexToWriteOnServer(nbWritten) = localGlobalIndexMap[data_i_index(idx)]; 
    1967       //       ++nbWritten; 
    1968       //     } 
    1969       //   } 
    1970  
    1971       //   numberWrittenIndexes_ = nbWritten; 
    1972       //   if (isDistributed()) 
    1973       //   {             
    1974       //     MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 
    1975       //     MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 
    1976       //     offsetWrittenIndexes_ -= numberWrittenIndexes_; 
    1977       //   } 
    1978       //   else 
    1979       //     totalNumberWrittenIndexes_ = numberWrittenIndexes_; 
    1980       // }       
    19811921   } 
    19821922 
     
    25332473           jIndex = (jIndex < 0) ? 0 : jIndex; 
    25342474           nbIndLoc = iIndex + ni * jIndex; 
    2535 //           if (nbIndLoc < nbIndexGlobMax)  // THIS CONDITION IMPEDES THE CASE OF A HOLE 
    2536 //           { 
    2537 //             i_index(nbIndLoc) = index % ni_glo; 
    2538 //             j_index(nbIndLoc) = index / ni_glo; 
    2539 //             globalLocalIndexMap_[index] = nbIndLoc; 
    2540 //             ++nbIndGlob; 
    2541 //           } 
    2542             i_index(nbIndGlob) = index % ni_glo; 
    2543             j_index(nbIndGlob) = index / ni_glo; 
    2544             globalLocalIndexMap_[index] = nbIndGlob; 
    2545             ++nbIndGlob; 
     2475           i_index(nbIndGlob) = index % ni_glo; 
     2476           j_index(nbIndGlob) = index / ni_glo; 
     2477           globalLocalIndexMap_[index] = nbIndGlob; 
     2478           ++nbIndGlob; 
    25462479         }  
    25472480      }  
     
    30012934         dataIIndex(lInd) = (-1 == dataIIndex(lInd)) ? tmpI(ind) : dataIIndex(lInd); // Only fill in dataIndex if there is no data 
    30022935         dataJIndex(lInd) = (-1 == dataJIndex(lInd)) ? tmpJ(ind) : dataJIndex(lInd);   
    3003  
    3004 //         if (!domainMask(lInd))   // Include mask info into data index on the RECEIVE getServerDimensionSizes 
    3005 //         { 
    3006 //           dataIIndex(lInd) = dataJIndex(lInd) = -1; 
    3007 //         } 
    30082936      }  
    30092937    } 
  • XIOS/dev/dev_olga/src/node/domain.hpp

    r1571 r1589  
    151151         bool hasLonLat; 
    152152         bool hasPole ; 
     153         bool hasLatInReadFile_ ; // specify if latitude is defined on read file, so it can be read later when grid distribution will be defined 
     154         bool hasBoundsLatInReadFile_ ; // specify if latitude boundarues are defined on read file, so it can be read later when grid distribution will be defined 
     155         bool hasLonInReadFile_ ; // specify if longitude is defined on read file, so it can be read later when grid distribution will be defined 
     156         bool hasBoundsLonInReadFile_ ; // specify if longitude boundaries are defined on read file, so it can be read later when grid distribution will be defined 
    153157 
    154158         void computeLocalMask(void) ; 
  • XIOS/dev/dev_olga/src/node/grid.cpp

    r1584 r1589  
    423423      } 
    424424   } 
    425  
    426  
    427 /*! 
    428   A grid can have multiple dimension, so can its mask in the form of multi-dimension array. 
    429 It's not a good idea to store all multi-dimension arrays corresponding to each mask. 
    430 One of the ways is to convert this array into 1-dimension one and every process is taken place on it. 
    431   \param [in] multi-dimension array grid mask 
    432 */ 
    433  
    434 //  void CGrid::getLocalMask(CArray<bool,1>& localMask) 
    435 //  { 
    436 //      std::vector<CDomain*> domainP = this->getDomains(); 
    437 //      std::vector<CAxis*> axisP = this->getAxis(); 
    438 //      int dim = domainP.size() * 2 + axisP.size(); 
    439 // 
    440 //      switch (dim) 
    441 //      { 
    442 //        case 0: 
    443 //          getLocalMask(mask_0d, localMask); 
    444 //          break; 
    445 //        case 1: 
    446 //          getLocalMask(mask_1d, localMask); 
    447 //          break; 
    448 //        case 2: 
    449 //          getLocalMask(mask_2d, localMask); 
    450 //          break; 
    451 //        case 3: 
    452 //          getLocalMask(mask_3d, localMask); 
    453 //          break; 
    454 //        case 4: 
    455 //          getLocalMask(mask_4d, localMask); 
    456 //          break; 
    457 //        case 5: 
    458 //          getLocalMask(mask_5d, localMask); 
    459 //          break; 
    460 //        case 6: 
    461 //          getLocalMask(mask_6d, localMask); 
    462 //          break; 
    463 //        case 7: 
    464 //          getLocalMask(mask_7d, localMask); 
    465 //          break; 
    466 //        default: 
    467 //          break; 
    468 //      } 
    469 //  } 
    470425       
    471426   /* 
     
    17881743          nGlob.push_back(1);   
    17891744        } 
    1790  
    1791 //        modifyMaskSize(nSize, false); 
    1792 //        modifyMaskSize(nSize, true);   // Grid mask should be gone beyond client source filter 
    1793 // 
    1794 //        // These below codes are reserved for future 
    1795 //        CDistributionServer srvDist(server->intraCommRank, nBegin, nSize, nBeginGlobal, nGlob); 
    1796 //        map<int, CArray<size_t, 1> >::iterator itb = outGlobalIndexFromClient.begin(), 
    1797 //                                               ite = outGlobalIndexFromClient.end(), it; 
    1798 //        const CDistributionServer::GlobalLocalMap&  globalLocalMask = srvDist.getGlobalLocalIndex(); 
    1799 //        CDistributionServer::GlobalLocalMap::const_iterator itSrv; 
    1800 //        size_t nb = 0; 
    1801 //        for (it = itb; it != ite; ++it) 
    1802 //        { 
    1803 //          CArray<size_t,1>& globalInd = it->second; 
    1804 //          for (size_t idx = 0; idx < globalInd.numElements(); ++idx) 
    1805 //          { 
    1806 //            if (globalLocalMask.end() != globalLocalMask.find(globalInd(idx))) ++nb; 
    1807 //          } 
    1808 //        } 
    1809 // 
    1810 //        CArray<int,1> indexToModify(nb); 
    1811 //        nb = 0; 
    1812 //        for (it = itb; it != ite; ++it) 
    1813 //        { 
    1814 //          CArray<size_t,1>& globalInd = it->second; 
    1815 //          for (size_t idx = 0; idx < globalInd.numElements(); ++idx) 
    1816 //          { 
    1817 //            itSrv = globalLocalMask.find(globalInd(idx)); 
    1818 //            if (globalLocalMask.end() != itSrv) 
    1819 //            { 
    1820 //              indexToModify(nb) = itSrv->second; 
    1821 //              ++nb; 
    1822 //            } 
    1823 //          } 
    1824 //        } 
    1825  
    1826 //        modifyMask(indexToModify, true); 
    18271745      } 
    18281746 
Note: See TracChangeset for help on using the changeset viewer.