Ignore:
Timestamp:
08/31/18 14:15:54 (6 years ago)
Author:
oabramkina
Message:

Further simplifications on sending data/grid indexes.

(1) Domain/axis mask is not sent anymore. It has been incorporated into data index.

(2) Creating a map that holds grid mask only in case if grid mask is defined.

Still to fix: a hole in a domain or axis.

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

Legend:

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

    r1568 r1570  
    300300      if (context->hasClient) 
    301301      { 
     302        this->checkMask(); 
    302303        this->checkData(); 
    303         this->checkMask(); 
    304304        this->checkLabel(); 
    305305      } 
     
    307307 
    308308   /*! 
    309       Check the validity of data and fill in values if any. 
     309      Check the validity of data, fill in values if any, and apply mask. 
    310310   */ 
    311311 
     
    331331        { 
    332332          if ((i+data_begin) >= 0 && (i+data_begin<n)) 
    333             data_index(i) = i+data_begin; 
     333          { 
     334            if (mask(i+data_begin)) 
     335              data_index(i) = i+data_begin; 
     336            else 
     337              data_index(i) = -1; 
     338          } 
    334339          else 
    335340            data_index(i) = -1; 
     
    344349                << "The size of data_index = "<< data_index.numElements() << "is not equal to the data size data_n = " << data_n.getValue() << ")."); 
    345350        } 
    346         data_index.resize(data_n); 
    347351        for (int i = 0; i < data_n; ++i) 
    348352        { 
    349           if ((i+data_begin) >= 0 && (i+data_begin<n)) 
    350             data_index(i) = data_index(i); 
    351           else 
     353          if ((i+data_begin) >= 0 && (i+data_begin<n) && !mask(i+data_begin)) 
    352354            data_index(i) = -1; 
    353355        } 
     
    10701072          ind = globalLocalIndexMap_[idx]; 
    10711073          dataIndi(n) = dataIndex(ind); 
    1072           maskIndi(n) = mask(ind); 
     1074//          maskIndi(n) = mask(ind); 
    10731075 
    10741076          if (hasValue) 
     
    10941096        listData.push_back(CMessage()); 
    10951097        listData.back() << this->getId() 
    1096                         << list_indi.back() << list_dataInd.back() << list_mask.back(); 
     1098                        << list_indi.back() << list_dataInd.back(); //<< list_mask.back(); 
    10971099 
    10981100        listData.back() << hasValue; 
     
    11551157      buffer >> vec_indi[idx]; 
    11561158      buffer >> vec_dataInd[idx];       
    1157       buffer >> vec_mask[idx]; 
     1159//      buffer >> vec_mask[idx]; 
    11581160 
    11591161      buffer >> hasValue; 
     
    12061208    CArray<int,1> nonCompressedData(nbData); 
    12071209    nonCompressedData = -1;    
    1208     mask.resize(nbData); 
    1209     mask = true; 
     1210//    mask.resize(nbData); 
     1211//    mask = true; 
     1212    // Mask is incorporated into data_index and is not sent/received anymore 
     1213    mask.resize(0); 
    12101214    if (hasValue) 
    12111215      value.resize(nbData); 
     
    12201224      CArray<int,1>& indi = vec_indi[idx]; 
    12211225      CArray<int,1>& dataIndi = vec_dataInd[idx]; 
    1222       CArray<bool,1>& maskIndi = vec_mask[idx]; 
     1226//      CArray<bool,1>& maskIndi = vec_mask[idx]; 
    12231227      int nb = indi.numElements(); 
    12241228      for (int n = 0; n < nb; ++n) 
     
    12281232        nonCompressedData(locInd) = (-1 == nonCompressedData(locInd)) ? dataIndi(n) : nonCompressedData(locInd); 
    12291233 
    1230         if (!mask(locInd)) // Only rewrite mask if it's not true 
    1231           mask(locInd) = maskIndi(n); 
     1234//        if (!mask(locInd)) // Only rewrite mask if it's not true 
     1235//          mask(locInd) = maskIndi(n); 
    12321236         
    12331237        if (hasValue) 
  • XIOS/dev/dev_olga/src/node/domain.cpp

    r1568 r1570  
    10811081   void CDomain::checkCompression(void) 
    10821082   { 
     1083     int i,j,ind; 
    10831084      if (!data_i_index.isEmpty()) 
    10841085      { 
     
    11011102                   << "'data_j_index' must be defined when 'data_i_index' is set and 'data_dim' is 2."); 
    11021103          } 
     1104          for (int k=0; k<data_i_index.numElements(); ++k) 
     1105          { 
     1106            i = data_i_index(k)+data_ibegin ; 
     1107            j = data_j_index(k)+data_jbegin ; 
     1108            if (i>=0 && i<ni && j>=0 && j<nj) 
     1109            { 
     1110              ind=j*ni+i ; 
     1111              if (!domainMask(ind)) 
     1112              { 
     1113                data_i_index(k) = -1; 
     1114                data_j_index(k) = -1; 
     1115              } 
     1116            } 
     1117            else 
     1118            { 
     1119              data_i_index(k) = -1; 
     1120              data_j_index(k) = -1; 
     1121            } 
     1122          } 
    11031123        } 
    11041124        else // (1 == data_dim) 
     
    11071127          { 
    11081128            data_j_index.resize(data_ni); 
    1109             for (int j = 0; j < data_ni; ++j) data_j_index(j) = 0; 
     1129            data_j_index(j) = 0; 
     1130          } 
     1131          for (int k=0; k<data_i_index.numElements(); ++k) 
     1132          { 
     1133            i=data_i_index(k)+data_ibegin ; 
     1134            if (i>=0 && i < domainMask.size()) 
     1135            { 
     1136              if (!domainMask(i)) data_i_index(k) = -1; 
     1137            } 
     1138            else 
     1139              data_i_index(k) = -1; 
     1140 
     1141            if (!domainMask(i)) data_i_index(k) = -1; 
    11101142          } 
    11111143        } 
     
    11221154          data_i_index.resize(data_ni); 
    11231155          data_j_index.resize(data_ni); 
    1124  
    1125           for (int i = 0; i < data_ni; ++i) 
     1156          data_j_index = 0; 
     1157 
     1158          for (int k = 0; k < data_ni; ++k) 
    11261159          { 
    1127             data_i_index(i) = i; 
    1128             data_j_index(i) = 0; 
     1160            i=k+data_ibegin ; 
     1161            if (i>=0 && i < domainMask.size()) 
     1162            { 
     1163              if (domainMask(i)) 
     1164                data_i_index(k) = k; 
     1165              else 
     1166                data_i_index(k) = -1; 
     1167            } 
     1168            else 
     1169              data_i_index(k) = -1; 
    11291170          } 
    11301171        } 
     
    11351176          data_j_index.resize(dsize); 
    11361177 
    1137           for(int count = 0, j = 0; j < data_nj; ++j) 
     1178          for(int count = 0, kj = 0; kj < data_nj; ++kj) 
    11381179          { 
    1139             for(int i = 0; i < data_ni; ++i, ++count) 
     1180            for(int ki = 0; ki < data_ni; ++ki, ++count) 
    11401181            { 
    1141               data_i_index(count) = i; 
    1142               data_j_index(count) = j; 
     1182              i = ki + data_ibegin; 
     1183              j = kj + data_jbegin; 
     1184              ind=j*ni+i ; 
     1185              if (i>=0 && i<ni && j>=0 && j<nj) 
     1186              { 
     1187                if (domainMask(ind)) 
     1188                { 
     1189                  data_i_index(count) = ki; 
     1190                  data_j_index(count) = kj; 
     1191                } 
     1192                else 
     1193                { 
     1194                  data_i_index(count) = -1; 
     1195                  data_j_index(count) = -1; 
     1196                } 
     1197              } 
     1198              else 
     1199              { 
     1200                data_i_index(count) = -1; 
     1201                data_j_index(count) = -1; 
     1202              } 
    11431203            } 
    11441204          } 
     
    19762036    sendDistributionAttributes(); 
    19772037    sendIndex();        
    1978     sendMask(); 
     2038//    sendMask(); 
    19792039    sendLonLat(); 
    19802040    sendArea();     
     
    24472507         { 
    24482508           iIndex = (index%ni_glo)-ibegin; 
    2449            iIndex = (iIndex < 0) ? 0 : iIndex;    // ?? 
     2509           iIndex = (iIndex < 0) ? 0 : iIndex; 
    24502510           jIndex = (index/ni_glo)-jbegin; 
    2451            jIndex = (jIndex < 0) ? 0 : jIndex;    // ?? 
     2511           jIndex = (jIndex < 0) ? 0 : jIndex; 
    24522512           nbIndLoc = iIndex + ni * jIndex; 
    2453            if (nbIndLoc < nbIndexGlobMax) 
     2513//           if (nbIndLoc < nbIndexGlobMax)  // THIS CONDITION IMPEDES THE CASE OF A HOLE 
    24542514           { 
    24552515             i_index(nbIndLoc) = index % ni_glo; 
     
    24762536      j_index.resizeAndPreserve(nbIndGlob); 
    24772537    } 
     2538 
     2539    domainMask.resize(0); // Mask is not defined anymore on servers 
    24782540  } 
    24792541 
     
    28962958      buffer >> recvDataJIndex[i]; 
    28972959    } 
    2898  
     2960    
    28992961    int nbIndex = i_index.numElements(); 
    29002962    CArray<int,1> dataIIndex(nbIndex), dataJIndex(nbIndex); 
    29012963    dataIIndex = -1; dataJIndex = -1; 
    2902  
     2964      
    29032965    nbIndex = 0; 
    29042966    for (i = 0; i < nbReceived; ++i) 
     
    29182980         dataJIndex(lInd) = (-1 == dataJIndex(lInd)) ? tmpJ(ind) : dataJIndex(lInd);   
    29192981 
    2920          if (!domainMask(lInd))   // Include mask info into data index on the RECEIVE getServerDimensionSizes 
    2921          { 
    2922            dataIIndex(lInd) = dataJIndex(lInd) = -1; 
    2923          } 
     2982//         if (!domainMask(lInd))   // Include mask info into data index on the RECEIVE getServerDimensionSizes 
     2983//         { 
     2984//           dataIIndex(lInd) = dataJIndex(lInd) = -1; 
     2985//         } 
    29242986      }  
    29252987    } 
  • XIOS/dev/dev_olga/src/node/grid.cpp

    r1568 r1570  
    693693     CContext* context = CContext::getCurrent(); 
    694694 
    695      CContextClient* client = context->client;  // Here it's not important which contextClient to recuperate 
     695     CContextClient* client = context->client; 
    696696     int rank = client->clientRank; 
    697697 
     
    699699     // Get local data index on client 
    700700     int nbStoreIndex = clientDistribution_->getLocalDataIndexOnClient().size(); 
     701     int nbStoreGridMask = clientDistribution_->getLocalMaskIndexOnClient().size(); 
     702     // nbStoreGridMask = nbStoreIndex if grid mask is defined, and 0 otherwise 
    701703     storeIndex_client.resize(nbStoreIndex); 
    702      storeMask_client.resize(nbStoreIndex); 
    703      for (int idx = 0; idx < nbStoreIndex; ++idx) 
    704      { 
    705        storeIndex_client(idx) = (clientDistribution_->getLocalDataIndexOnClient())[idx]; 
    706        storeMask_client(idx) = (clientDistribution_->getLocalMaskIndexOnClient())[idx]; 
    707      } 
     704     storeMask_client.resize(nbStoreGridMask); 
     705     for (int idx = 0; idx < nbStoreIndex; ++idx) storeIndex_client(idx) = (clientDistribution_->getLocalDataIndexOnClient())[idx]; 
     706     for (int idx = 0; idx < nbStoreGridMask; ++idx) storeMask_client(idx) = (clientDistribution_->getLocalMaskIndexOnClient())[idx]; 
    708707 
    709708     if (0 == serverDistribution_) isDataDistributed_= clientDistribution_->isDataDistributed(); 
     
    13021301      const StdSize size = storeIndex_client.numElements(); 
    13031302      stored.resize(size); 
    1304  
    13051303      const double nanValue = std::numeric_limits<double>::quiet_NaN(); 
    1306       for(StdSize i = 0; i < size; i++) stored(i) = (storeMask_client(i)) ? data[storeIndex_client(i)] : nanValue; 
     1304 
     1305      if (storeMask_client.numElements() != 0) 
     1306        for(StdSize i = 0; i < size; i++) stored(i) = (storeMask_client(i)) ? data[storeIndex_client(i)] : nanValue; 
     1307      else 
     1308        for(StdSize i = 0; i < size; i++) stored(i) = data[storeIndex_client(i)]; 
    13071309   } 
    13081310 
Note: See TracChangeset for help on using the changeset viewer.