Ignore:
Timestamp:
07/07/17 18:17:49 (7 years ago)
Author:
oabramkina
Message:

Two server levels: merging trunk r1200 (except for non-contiguous zoom) into dev. Tested on Curie. Todo: non-contiguous zoom.

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

Legend:

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

    r1158 r1201  
    123123        int zoom_begin_srv, zoom_end_srv, zoom_size_srv; 
    124124        int ni_srv, begin_srv, end_srv; 
     125        int global_zoom_begin_srv, global_zoom_end_srv, global_zoom_size_srv; 
    125126        CArray<double,1> value_srv; 
    126127        CArray<double,2> bound_srv; 
    127128        CArray<StdString,1> label_srv; 
     129        CArray<int,1> zoom_index_srv; 
    128130        bool hasValue; 
    129131        CArray<int,1> globalDimGrid; 
     
    144146         void computeConnectedServer(const std::vector<int>& globalDim, int orderPositionInGrid, 
    145147                                     CServerDistributionDescription::ServerDistributionType distType); 
     148         bool zoomByIndex(); 
    146149 
    147150         void sendNonDistributedAttributes(void); 
  • XIOS/dev/dev_olga/src/node/calendar_wrapper.cpp

    r1158 r1201  
    77namespace xios { 
    88 
    9   /// ////////////////////// Dfinitions ////////////////////// /// 
     9  /// ////////////////////// Définitions ////////////////////// /// 
    1010 
    1111  CCalendarWrapper::CCalendarWrapper(void) 
  • XIOS/dev/dev_olga/src/node/context.cpp

    r1194 r1201  
    291291   void CContext::setClientServerBuffer(CContextClient* contextClient) 
    292292   { 
    293      size_t minBufferSize = CXios::minBufferSize; 
     293      // Estimated minimum event size for small events (10 is an arbitrary constant just for safety) 
     294      const size_t minEventSize = CEventClient::headerSize + getIdServer().size() + 10 * sizeof(int); 
     295 
     296      // Ensure there is at least some room for 20 of such events in the buffers 
     297      size_t minBufferSize = std::max(CXios::minBufferSize, 20 * minEventSize); 
     298 
    294299#define DECLARE_NODE(Name_, name_)    \ 
    295300     if (minBufferSize < sizeof(C##Name_##Definition)) minBufferSize = sizeof(C##Name_##Definition); 
     
    299304#undef DECLARE_NODE_PAR 
    300305 
     306     // Compute the buffer sizes needed to send the attributes and data corresponding to fields 
    301307     std::map<int, StdSize> maxEventSize; 
    302308     std::map<int, StdSize> bufferSize = getAttributesBufferSize(maxEventSize, contextClient); 
     
    307313       if (it->second > bufferSize[it->first]) bufferSize[it->first] = it->second; 
    308314 
     315     // Apply the buffer size factor and check that we are above the minimum buffer size 
    309316     ite = bufferSize.end(); 
    310317     for (it = bufferSize.begin(); it != ite; ++it) 
     
    314321     } 
    315322 
    316      // We consider that the minimum buffer size is also the minimum event size 
    317      ite = maxEventSize.end(); 
    318      for (it = maxEventSize.begin(); it != ite; ++it) 
    319        if (it->second < minBufferSize) it->second = minBufferSize; 
    320  
     323     // Leaders will have to send some control events so ensure there is some room for those in the buffers 
    321324     if (contextClient->isServerLeader()) 
    322325     { 
    323326       const std::list<int>& ranks = contextClient->getRanksServerLeader(); 
    324327       for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    325          if (!bufferSize.count(*itRank)) bufferSize[*itRank] = maxEventSize[*itRank] = minBufferSize; 
     328       { 
     329         if (!bufferSize.count(*itRank)) 
     330         { 
     331           bufferSize[*itRank] = minBufferSize; 
     332           maxEventSize[*itRank] = minEventSize; 
     333         } 
     334       } 
    326335     } 
    327336     contextClient->setBufferSize(bufferSize, maxEventSize); 
  • XIOS/dev/dev_olga/src/node/domain.cpp

    r1173 r1201  
    24632463    } 
    24642464     
     2465    i_index.resize(nbIndGlob); 
     2466    j_index.resize(nbIndGlob); 
     2467 
    24652468    globalLocalIndexMap_.rehash(std::ceil(nbIndGlob/globalLocalIndexMap_.max_load_factor())); 
    2466     i_index.resize(nbIndGlob); 
    2467     j_index.resize(nbIndGlob);     
    24682469    nbIndGlob = 0; 
    24692470    for (i = 0; i < nbReceived; ++i) 
     
    24732474      { 
    24742475         index = tmp(ind); 
    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          }  
     2476         i_index(nbIndGlob) = index % ni_glo; 
     2477         j_index(nbIndGlob) = index / ni_glo; 
     2478         globalLocalIndexMap_[index] = nbIndGlob;   
     2479         ++nbIndGlob; 
    24822480      }  
    24832481    }  
    2484  
    2485     i_index.resizeAndPreserve(nbIndGlob); 
    2486     j_index.resizeAndPreserve(nbIndGlob); 
    24872482  } 
    24882483 
     
    26352630  void CDomain::recvMask(std::map<int, CBufferIn*>& rankBuffers) 
    26362631  { 
    2637     int nbReceived = rankBuffers.size(), i, ind, index, lInd; 
     2632    int nbReceived = rankBuffers.size(), i, ind, index; 
    26382633    if (nbReceived != recvClientRanks_.size()) 
    2639       ERROR("void CDomain::recvMask(std::map<int, CBufferIn*>& rankBuffers)", 
     2634      ERROR("void CDomain::recvArea(std::map<int, CBufferIn*>& rankBuffers)", 
    26402635           << "The number of sending clients is not correct." 
    26412636           << "Expected number: " << recvClientRanks_.size() << " but received " << nbReceived); 
     
    26552650    } 
    26562651   
    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(); 
    26622652    mask_1d.resize(nbMaskInd); 
    2663      
     2653    nbMaskInd = 0; 
    26642654    for (i = 0; i < nbReceived; ++i) 
    26652655    { 
    2666       CArray<int,1>& tmpInd = indGlob_[recvClientRanks_[i]]; 
    26672656      CArray<bool,1>& tmp = recvMaskValue[i]; 
    26682657      for (ind = 0; ind < tmp.numElements(); ++ind) 
    26692658      { 
    2670         lInd = globalLocalIndexMap_[size_t(tmpInd(ind))]; 
    2671         mask_1d(lInd) = tmp(ind); 
     2659        mask_1d(nbMaskInd) = tmp(ind);       
     2660        ++nbMaskInd; 
    26722661      } 
    26732662    }     
     
    27282717     
    27292718      if (nbLonInd != globalLocalIndexMap_.size()) 
    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(); 
     2719        info (0) << "Something wrong with longitude index "<< std::endl; 
     2720 
    27342721      lonvalue.resize(nbLonInd); 
    27352722      if (hasBounds) 
     
    28122799     
    28132800      if (nbLatInd != globalLocalIndexMap_.size()) 
    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(); 
     2801        info (0) << "Something wrong with latitude index "<< std::endl; 
     2802 
    28182803      latvalue.resize(nbLatInd); 
    28192804      if (hasBounds) 
     
    28852870    } 
    28862871 
     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 
    28872881    if (hasArea) 
    28882882    { 
    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(); 
    29002883      areavalue.resize(nbAreaInd); 
    29012884      nbAreaInd = 0;       
     
    30052988      { 
    30062989         lInd = globalLocalIndexMap_[size_t(tmpInd(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);          
     2990         dataIIndex(lInd) = tmpI(ind); 
     2991         dataJIndex(lInd) = tmpJ(ind);          
    30092992      }  
    30102993    } 
  • XIOS/dev/dev_olga/src/node/field.cpp

    r1166 r1201  
    131131 
    132132    CContext* context = CContext::getCurrent(); 
    133       CContextClient* client = (!context->hasServer) ? context->client : this->file->getContextClient(); 
    134  
    135       CEventClient event(getType(), EVENT_ID_UPDATE_DATA); 
    136  
    137       map<int, CArray<int,1> >::iterator it; 
    138       list<CMessage> list_msg; 
    139       list<CArray<double,1> > list_data; 
    140  
    141       if (!grid->doGridHaveDataDistributed()) 
     133    CContextClient* client = (!context->hasServer) ? context->client : this->file->getContextClient(); 
     134 
     135    CEventClient event(getType(), EVENT_ID_UPDATE_DATA); 
     136 
     137    map<int, CArray<int,1> >::iterator it; 
     138    list<CMessage> list_msg; 
     139    list<CArray<double,1> > list_data; 
     140 
     141    if (!grid->doGridHaveDataDistributed()) 
     142    { 
     143       if (client->isServerLeader()) 
     144       { 
     145          for (it = grid->storeIndex_toSrv.begin(); it != grid->storeIndex_toSrv.end(); it++) 
     146          { 
     147            int rank = it->first; 
     148            CArray<int,1>& index = it->second; 
     149 
     150            list_msg.push_back(CMessage()); 
     151            list_data.push_back(CArray<double,1>(index.numElements())); 
     152 
     153            CArray<double,1>& data_tmp = list_data.back(); 
     154            for (int n = 0; n < data_tmp.numElements(); n++) data_tmp(n) = data(index(n)); 
     155 
     156            list_msg.back() << getId() << data_tmp; 
     157            event.push(rank, 1, list_msg.back()); 
     158          } 
     159          client->sendEvent(event); 
     160        } 
     161      else client->sendEvent(event); 
     162    } 
     163    else 
     164    { 
     165      for (it = grid->storeIndex_toSrv.begin(); it != grid->storeIndex_toSrv.end(); it++) 
    142166      { 
    143          if (client->isServerLeader()) 
    144          { 
    145             for (it = grid->storeIndex_toSrv.begin(); it != grid->storeIndex_toSrv.end(); it++) 
    146             { 
    147               int rank = it->first; 
    148               CArray<int,1>& index = it->second; 
    149  
    150               list_msg.push_back(CMessage()); 
    151               list_data.push_back(CArray<double,1>(index.numElements())); 
    152  
    153               CArray<double,1>& data_tmp = list_data.back(); 
    154               for (int n = 0; n < data_tmp.numElements(); n++) data_tmp(n) = data(index(n)); 
    155  
    156               list_msg.back() << getId() << data_tmp; 
    157               event.push(rank, 1, list_msg.back()); 
    158             } 
    159             client->sendEvent(event); 
    160          } 
    161          else client->sendEvent(event); 
    162       } 
    163       else 
    164       { 
    165         for (it = grid->storeIndex_toSrv.begin(); it != grid->storeIndex_toSrv.end(); it++) 
    166         { 
    167           int rank = it->first; 
    168           CArray<int,1>& index = it->second; 
    169  
    170           list_msg.push_back(CMessage()); 
    171           list_data.push_back(CArray<double,1>(index.numElements())); 
    172  
    173           CArray<double,1>& data_tmp = list_data.back(); 
    174           for (int n = 0; n < data_tmp.numElements(); n++) data_tmp(n) = data(index(n)); 
    175  
    176           list_msg.back() << getId() << data_tmp; 
    177           event.push(rank, grid->nbSenders[0][rank], list_msg.back()); 
    178         } 
    179         client->sendEvent(event); 
    180       }     
     167        int rank = it->first; 
     168        CArray<int,1>& index = it->second; 
     169 
     170        list_msg.push_back(CMessage()); 
     171        list_data.push_back(CArray<double,1>(index.numElements())); 
     172 
     173        CArray<double,1>& data_tmp = list_data.back(); 
     174        for (int n = 0; n < data_tmp.numElements(); n++) data_tmp(n) = data(index(n)); 
     175 
     176        list_msg.back() << getId() << data_tmp; 
     177        event.push(rank, grid->nbSenders[0][rank], list_msg.back()); 
     178      } 
     179      client->sendEvent(event); 
     180    } 
    181181 
    182182    CTimer::get("Field : send data").suspend(); 
     
    276276  { 
    277277    CContext* context = CContext::getCurrent(); 
     278//    CContextClient* client = context->client; 
    278279    CContextClient* client = (!context->hasServer) ? context->client : this->file->getContextClient(); 
    279  
    280280 
    281281    lastDataRequestedFromServer = tsDataRequested; 
     
    336336    CContext* context = CContext::getCurrent(); 
    337337    CContextClient* client = context->client; 
     338//    CContextClient* client = (!context->hasServer) ? context->client : this->file->getContextClient(); 
    338339 
    339340    CEventClient event(getType(), EVENT_ID_READ_DATA_READY); 
     
    854855   {      
    855856    if (!isReferenceSolvedAndTransformed) solveAllEnabledFieldsAndTransform(); 
     857 
     858     const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
     859     const double defaultValue  = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 
     860 
    856861     CContext* context = CContext::getCurrent(); 
    857862     bool hasWriterServer = context->hasServer && !context->hasClient; 
     
    906911             if (grid && grid != gridRef && grid->hasTransform()) 
    907912             { 
    908                bool hasMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
    909                double defaultValue  = hasMissingValue ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 
    910                std::pair<boost::shared_ptr<CFilter>, boost::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, hasMissingValue, defaultValue); 
     913                 std::pair<boost::shared_ptr<CFilter>, boost::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, detectMissingValues, defaultValue);  
    911914 
    912915               filter->connectOutput(filters.first, 0); 
     
    924927           instantDataFilter = serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, 
    925928                                                                                                       freq_offset.isEmpty() ? NoneDu : freq_offset, 
    926                                                                                                        true)); 
     929                                                                                                       true, 
     930                                                                                                       detectMissingValues, defaultValue)); 
    927931         else // The data might be passed from the model 
    928932         { 
    929             bool ignoreMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
    930             double defaultValue  = ignoreMissingValue ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 
     933            if (check_if_active.isEmpty()) check_if_active = false;  
    931934            instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, NoneDu, false, 
    932                                                                                                         ignoreMissingValue, defaultValue)); 
     935                                                                                                        detectMissingValues, defaultValue)); 
    933936         } 
    934937       } 
     
    937940       if (enableOutput && !storeFilter && !fileWriterFilter) 
    938941       { 
    939          if (!read_access.isEmpty() && read_access) 
    940          { 
    941            storeFilter = boost::shared_ptr<CStoreFilter>(new CStoreFilter(gc, CContext::getCurrent(), grid)); 
    942            instantDataFilter->connectOutput(storeFilter, 0); 
    943          } 
    944  
    945          if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write)) 
    946          { 
    947            fileWriterFilter = boost::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this)); 
    948            getTemporalDataFilter(gc, file->output_freq)->connectOutput(fileWriterFilter, 0); 
    949          } 
     942         storeFilter = boost::shared_ptr<CStoreFilter>(new CStoreFilter(gc, CContext::getCurrent(), grid, 
     943                                                                        detectMissingValues, defaultValue)); 
     944         instantDataFilter->connectOutput(storeFilter, 0); 
     945       } 
     946 
     947       if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write)) 
     948       { 
     949         fileWriterFilter = boost::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this)); 
     950         getTemporalDataFilter(gc, file->output_freq)->connectOutput(fileWriterFilter, 0); 
    950951       } 
    951952     } 
     
    10011002     if (!selfReferenceFilter) 
    10021003     { 
     1004       const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
     1005       const double defaultValue  = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 
     1006 
    10031007       if (file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read) 
    10041008       { 
     
    10061010           serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, 
    10071011                                                                                   freq_offset.isEmpty() ? NoneDu : freq_offset, 
    1008                                                                                    true)); 
     1012                                                                                   true, 
     1013                                                                                   detectMissingValues, defaultValue)); 
     1014 
    10091015         selfReferenceFilter = serverSourceFilter; 
    10101016       } 
     
    10191025         if (!clientSourceFilter) 
    10201026         { 
    1021            bool ignoreMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
    1022            double defaultValue  = ignoreMissingValue ? default_value : (!default_value.isEmpty() ? default_value : 0.0);  
     1027           if (check_if_active.isEmpty()) check_if_active = false; 
    10231028           clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, NoneDu, false, 
    1024                                                                                    ignoreMissingValue, defaultValue)); 
     1029                                                                                   detectMissingValues, defaultValue)); 
    10251030         } 
    10261031 
     
    10561061         freq_offset.setValue(NoneDu); 
    10571062 
    1058        const bool ignoreMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
    1059  
     1063       const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
     1064        
    10601065       boost::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, 
    10611066                                                                             CContext::getCurrent()->getCalendar()->getInitDate(), 
    10621067                                                                             freq_op, freq_offset, outFreq, 
    1063                                                                              ignoreMissingValue, ignoreMissingValue ? default_value : 0.0)); 
     1068                                                                             detectMissingValues, detectMissingValues ? default_value : 0.0)); 
    10641069       instantDataFilter->connectOutput(temporalFilter, 0); 
    10651070 
     
    10961101       if (freq_offset.isEmpty()) freq_offset.setValue(NoneDu); 
    10971102 
    1098        const bool ignoreMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
     1103       const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
    10991104 
    11001105       boost::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, 
    11011106                                                                             CContext::getCurrent()->getCalendar()->getInitDate(), 
    11021107                                                                             freq_op, freq_offset, outFreq, 
    1103                                                                              ignoreMissingValue, ignoreMissingValue ? default_value : 0.0)); 
     1108                                                                             detectMissingValues, detectMissingValues ? default_value : 0.0)); 
    11041109       selfReferenceFilter->connectOutput(temporalFilter, 0); 
    11051110       return temporalFilter ; 
  • XIOS/dev/dev_olga/src/node/field_impl.hpp

    r1021 r1201  
    1919  { 
    2020    if (clientSourceFilter) 
    21       clientSourceFilter->streamData(CContext::getCurrent()->getCalendar()->getCurrentDate(), _data); 
     21    { 
     22      if (check_if_active.isEmpty() || (!check_if_active.isEmpty() && (!check_if_active) || isActive(true))) 
     23        clientSourceFilter->streamData(CContext::getCurrent()->getCalendar()->getCurrentDate(), _data); 
     24    } 
    2225    else if (instantDataFilter) 
    2326      ERROR("void CField::setData(const CArray<double, N>& _data)", 
  • XIOS/dev/dev_olga/src/node/file.cpp

    r1158 r1201  
    425425         if (!split_freq.isEmpty()) 
    426426         { 
    427            CDate splitEnd = lastSplit + split_freq - 1 * Second; 
     427           CDate split_start ; 
     428           CDate splitEnd ; 
     429           if (!split_start_offset.isEmpty()) split_start=lastSplit + split_start_offset ; 
     430           else split_start=lastSplit ; 
     431 
     432           splitEnd = lastSplit + split_freq ; 
     433           if (!split_last_date.isEmpty()) 
     434           { 
     435             CDate splitLastDate=CDate::FromString(split_last_date,*CContext::getCurrent()->getCalendar()) ; 
     436             if( splitLastDate < splitEnd)  splitEnd=splitLastDate ; 
     437           } 
     438             
     439           if (!split_end_offset.isEmpty()) splitEnd = splitEnd + split_end_offset; 
     440           else splitEnd = splitEnd - 1 * Second; 
    428441 
    429442           string splitFormat; 
     
    440453 
    441454           oss << firstPart ; 
    442            if (hasStartDate) oss << lastSplit.getStr(splitFormat) ; 
     455           if (hasStartDate) oss << split_start.getStr(splitFormat) ; 
    443456           oss << middlePart ; 
    444457           if (hasEndDate) oss << splitEnd.getStr(splitFormat); 
  • XIOS/dev/dev_olga/src/node/grid.cpp

    r1178 r1201  
    287287     nbSrvPools = 1;   
    288288     for (int p = 0; p < nbSrvPools; ++p) 
    289      {     
    290        if (context->hasClient && this->isChecked && doSendingIndex && !isIndexSent)  
    291        {  
    292          if (isScalarGrid()) 
    293            sendIndexScalarGrid(); 
    294          else 
    295            sendIndex(); 
    296          this->isIndexSent = true;  
     289     {        
     290       if (isScalarGrid()) 
     291       {   
     292          if (context->hasClient) 
     293            if (this->isChecked && doSendingIndex && !isIndexSent) { sendIndexScalarGrid(); this->isIndexSent = true; } 
     294 
     295          if (this->isChecked) continue; 
     296   
     297          if (context->hasClient) 
     298          { 
     299            this->computeIndexScalarGrid(); 
     300          } 
     301   
     302         if (!(this->hasTransform() && !this->isTransformed())) 
     303          this->isChecked = true; 
     304         continue; 
    297305       } 
    298306 
    299        // Not sure about this 
    300        //if (!(this->hasTransform() && !this->isTransformed())) 
    301        // this->isChecked = true; 
    302        //return; 
     307       if (context->hasClient) 
     308       { 
     309         if (this->isChecked && doSendingIndex && !isIndexSent) 
     310            {sendIndex(); this->isIndexSent = true;} 
     311       } 
    303312     } 
    304313     
     
    537546      if (computedWrittenIndex_) return; 
    538547      computedWrittenIndex_ = true; 
    539  
    540       if (isScalarGrid()) 
    541       { 
    542         size_t nbWritten = 1; 
    543         int writtenIndex = 0; 
    544  
    545         localIndexToWriteOnClient.resize(nbWritten);   
    546         localIndexToWriteOnServer.resize(nbWritten); 
    547         localIndexToWriteOnServer(0) = writtenIndex; 
    548         localIndexToWriteOnClient(0) = writtenIndex; 
    549          
    550         return; 
    551       } 
    552548 
    553549      size_t nbWritten = 0, indGlo; 
     
    750746   { 
    751747     CContext* context = CContext::getCurrent(); 
    752      if (isScalarGrid()) 
     748     computeClientIndex(); 
     749     if (context->hasClient) 
    753750     { 
    754        computeClientIndexScalarGrid(); 
    755        if (context->hasClient) 
    756        { 
    757          computeConnectedClientsScalarGrid(); 
    758        } 
    759      } 
    760      else 
    761      { 
    762        computeClientIndex(); 
    763        if (context->hasClient) 
    764        { 
    765          computeConnectedClients(); 
    766        } 
     751       computeConnectedClients(); 
    767752     } 
    768753   } 
     
    11861171   } 
    11871172 
    1188   void CGrid::computeClientIndexScalarGrid() 
    1189   { 
    1190     CContext* context = CContext::getCurrent();     
    1191     int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; // This should be changed soon 
    1192     for (int p = 0; p < nbSrvPools; ++p) 
    1193     { 
    1194       CContextClient* client = (context->hasServer) ? (context->hasClient ? context->clientPrimServer[p] : context->client)  
    1195                                                     : context->client; 
    1196  
    1197       storeIndex_client.resize(1); 
    1198       storeIndex_client(0) = 0;       
    1199  
    1200       if (0 != serverDistribution_) 
    1201       { 
    1202         map<int, CArray<size_t, 1> >::iterator itb = outGlobalIndexFromClient.begin(), 
    1203                                                ite = outGlobalIndexFromClient.end(), it; 
    1204         for (it = itb; it != ite; ++it) 
    1205         { 
    1206           int rank = it->first; 
    1207           CArray<size_t,1>& globalIndex = outGlobalIndexFromClient[rank]; 
    1208           outLocalIndexStoreOnClient.insert(make_pair(rank, CArray<size_t,1>(globalIndex.numElements()))); 
    1209           CArray<size_t,1>& localIndex = outLocalIndexStoreOnClient[rank]; 
    1210           if (1 != globalIndex.numElements()) 
    1211             ERROR("void CGrid::computeClientIndexScalarGrid()", 
    1212               << "Something wrong happened. " 
    1213               << "Number of received global index on scalar grid should equal to 1"  
    1214               << "Number of received global index " << globalIndex.numElements() << "."); 
    1215  
    1216           localIndex(0) = globalIndex(0); 
    1217         } 
    1218       } 
    1219     } 
    1220   } 
    1221  
    1222   void CGrid::computeConnectedClientsScalarGrid() 
     1173  void CGrid::computeIndexScalarGrid() 
    12231174  { 
    12241175    CContext* context = CContext::getCurrent();     
     
    12301181    for (int p = 0; p < nbSrvPools; ++p) 
    12311182    { 
    1232       CContextClient* client = (context->hasServer) ? (context->hasClient ? context->clientPrimServer[p] : context->client)  
    1233                                                     : context->client; 
     1183      CContextClient* client = context->hasServer ? context->clientPrimServer[p] : context->client; 
     1184 
     1185      storeIndex_client.resize(1); 
     1186      storeIndex_client(0) = 0; 
    12341187 
    12351188      connectedServerRank_[p].clear(); 
    12361189 
    1237       if (client->isServerLeader()) 
    1238       { 
    1239         const std::list<int>& ranks = client->getRanksServerLeader(); 
    1240         for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    1241         { 
    1242           int rank = *itRank; 
    1243           int nb = 1; 
     1190      if (0 == client->clientRank) 
     1191      { 
     1192        for (int rank = 0; rank < client->serverSize; ++rank) 
     1193        { 
    12441194          connectedServerRank_[p].push_back(rank); 
    1245           connectedDataSize_[p][rank] = nb; 
    1246           nbSenders[p][rank] = nb; 
    1247         } 
    1248       } 
    1249       else 
    1250       { 
    1251         const std::list<int>& ranks = client->getRanksServerNotLeader(); 
    1252         for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    1253         { 
    1254           int rank = *itRank; 
    1255           int nb = 1; 
    1256           connectedServerRank_[p].push_back(rank); 
    1257           connectedDataSize_[p][rank] = nb; 
    1258           nbSenders[p][rank] = nb; 
    1259         }         
    1260       } 
    1261  
     1195          connectedDataSize_[p][rank] = 1; 
     1196          nbSenders[p][rank] = 1; 
     1197        } 
     1198      } 
    12621199      isDataDistributed_ = false; 
    12631200    } 
  • XIOS/dev/dev_olga/src/node/grid.hpp

    r1178 r1201  
    278278        void computeClientIndex(); 
    279279        void computeConnectedClients(); 
    280         void computeClientIndexScalarGrid(); 
    281         void computeConnectedClientsScalarGrid();         
    282280 
    283281      private: 
  • XIOS/dev/dev_olga/src/node/zoom_axis.cpp

    r836 r1201  
    4646    axisGlobalSize   = axisDest->n_glo.getValue(); 
    4747 
    48     begin = (this->begin.isEmpty()) ?  0 : this->begin.getValue(); 
    49     n     = (this->n.isEmpty()) ?  axisGlobalSize : this->n.getValue(); 
    50     end   = begin+n-1; 
     48    bool zoomByIndex = !this->index.isEmpty() && (0 != this->index.numElements()); 
     49 
     50    if (zoomByIndex) 
     51    { 
     52      begin = min(this->index); 
     53      end   = max(this->index); 
     54      n     = end - begin + 1; 
     55    } 
     56    else 
     57    { 
     58      begin = (this->begin.isEmpty()) ?  0 : this->begin.getValue(); 
     59      n     = (this->n.isEmpty()) ?  axisGlobalSize : this->n.getValue(); 
     60      end   = begin+n-1; 
     61    } 
    5162 
    5263    if (begin < 0 || begin > axisGlobalSize - 1 || end < 0 || end > axisGlobalSize - 1 
     
    5566            << "One or more attributes among 'begin' (" << begin << "), 'end' (" << end << "), 'n' (" << n << ") " 
    5667            << "of axis transformation [ id = '" << axisDest->getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] are not well specified"); 
     68     
     69    if (zoomByIndex && (!this->begin.isEmpty() || !this->n.isEmpty())) 
     70      ERROR("CZoomAxis::checkValid(CAxis* axisDest)", 
     71            << "Only one type of zoom is accepted. Define zoom by index with global_zoom_index or define zoom with begin and n. " 
     72            << "Axis transformation [ id = '" << axisDest->getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] are not well specified"); 
    5773 
    5874    this->begin.setValue(begin); 
Note: See TracChangeset for help on using the changeset viewer.