Ignore:
Timestamp:
07/10/17 18:17:04 (7 years ago)
Author:
yushan
Message:

branch merged with trunk @1200

Location:
XIOS/dev/branch_yushan_merged/src/node
Files:
8 edited

Legend:

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

    r1134 r1205  
    367367    // We don't check if the mask is valid here, just if a mask has been defined at this point. 
    368368    isCompressible_ = !mask.isEmpty(); 
     369  } 
     370 
     371  bool CAxis::zoomByIndex() 
     372  { 
     373    return (!global_zoom_index.isEmpty() && (0 != global_zoom_index.numElements())); 
    369374  } 
    370375 
     
    463468    size_t nZoomCount = 0; 
    464469    size_t nbIndex = index.numElements(); 
    465     for (size_t idx = 0; idx < nbIndex; ++idx) 
     470 
     471    int end = (0 == n) ? begin : begin + n - 1; 
     472    int zoom_size = zoomByIndex() ? global_zoom_index.numElements() : global_zoom_n; 
     473    int minInd = min(index); 
     474    int maxInd = max(index); 
     475    for (size_t idx = 0; idx < zoom_size; ++idx) 
     476    { 
     477      size_t globalZoomIndex = zoomByIndex() ? global_zoom_index(idx) : global_zoom_begin + idx; 
     478      if (globalZoomIndex >= minInd && globalZoomIndex <= maxInd) ++nZoomCount; 
     479    } 
     480 
     481/*    for (size_t idx = 0; idx < nbIndex; ++idx) 
    466482    { 
    467483      size_t globalIndex = index(idx); 
    468484      if (globalIndex >= global_zoom_begin && globalIndex <= zoom_end) ++nZoomCount; 
    469     } 
    470  
     485    }*/ 
     486     
    471487    CArray<size_t,1> globalIndexAxis(nbIndex); 
     488    for (size_t idx = 0; idx < nbIndex; ++idx) 
     489    {       
     490      globalIndexAxis(idx) = (size_t)index(idx); 
     491    } 
     492 
    472493    std::vector<size_t> globalAxisZoom(nZoomCount); 
    473494    nZoomCount = 0; 
    474     for (size_t idx = 0; idx < nbIndex; ++idx) 
    475     { 
    476       size_t globalIndex = index(idx); 
    477       globalIndexAxis(idx) = globalIndex; 
    478       if (globalIndex >= global_zoom_begin && globalIndex <= zoom_end) 
    479       { 
    480         globalAxisZoom[nZoomCount] = globalIndex; 
     495    for (size_t idx = 0; idx < zoom_size; ++idx) 
     496    { 
     497      size_t globalZoomIndex = zoomByIndex() ? global_zoom_index(idx) : global_zoom_begin + idx; 
     498      if (globalZoomIndex >= minInd && globalZoomIndex <= maxInd) 
     499      { 
     500        globalAxisZoom[nZoomCount] = globalZoomIndex; 
    481501        ++nZoomCount; 
    482502      } 
     
    598618    int zoom_end = global_zoom_begin + global_zoom_n - 1; 
    599619    int nb = 0; 
    600     for (size_t idx = 0; idx < n; ++idx) 
     620/*    for (size_t idx = 0; idx < n; ++idx) 
    601621    { 
    602622      size_t globalIndex = begin + idx; 
    603623      if (globalIndex >= global_zoom_begin && globalIndex <= zoom_end) ++nb; 
     624    }*/ 
     625 
     626    int end = (0 == n) ? begin : begin + n - 1; 
     627    int zoom_size = zoomByIndex() ? global_zoom_index.numElements() : global_zoom_n; 
     628    for (size_t idx = 0; idx < zoom_size; ++idx) 
     629    { 
     630      size_t globalZoomIndex = zoomByIndex() ? global_zoom_index(idx) : global_zoom_begin + idx; 
     631      if (globalZoomIndex >= begin && globalZoomIndex <= end) ++nb; 
    604632    } 
    605633 
     
    622650    CArray<double,1> val(nb); 
    623651    nb = 0; 
    624     for (size_t idx = 0; idx < n; ++idx) 
     652/*    for (size_t idx = 0; idx < n; ++idx) 
    625653    { 
    626654      size_t globalIndex = begin + idx; 
     
    628656      { 
    629657        val(nb) = value(idx); 
     658        ++nb; 
     659      } 
     660    }*/ 
     661 
     662    for (size_t idx = 0; idx < zoom_size; ++idx) 
     663    { 
     664      size_t globalZoomIndex = zoomByIndex() ? global_zoom_index(idx) : global_zoom_begin + idx; 
     665      if (globalZoomIndex >= begin && globalZoomIndex <= end) 
     666      { 
     667        val(nb) = value(globalZoomIndex-begin); 
    630668        ++nb; 
    631669      } 
     
    933971        const int ni    = serverDimensionSizes[*itRank][orderPositionInGrid]; 
    934972        const int end   = begin + ni - 1; 
     973        const bool zoomIndex = zoomByIndex(); 
    935974 
    936975        msgs.push_back(CMessage()); 
     
    940979        msg << global_zoom_begin.getValue() << global_zoom_n.getValue(); 
    941980        msg << isCompressible_; 
     981        msg << zoomIndex; 
     982        if (zoomIndex) 
     983          msg << global_zoom_index.getValue(); 
    942984 
    943985        event.push(*itRank,1,msg); 
     
    9591001  { 
    9601002    int ni_srv, begin_srv, end_srv, global_zoom_begin_tmp, global_zoom_n_tmp; 
     1003    bool zoomIndex;     
     1004    CArray<int,1> zoom_index_recv; 
     1005    std::vector<int> zoom_index_tmp; 
     1006    std::vector<int>::iterator itZoomBeginSrv, itZoomEndSrv, itZoomSrv; 
    9611007 
    9621008    buffer >> ni_srv >> begin_srv >> end_srv; 
    9631009    buffer >> global_zoom_begin_tmp >> global_zoom_n_tmp; 
    9641010    buffer >> isCompressible_; 
     1011    buffer >> zoomIndex; 
     1012    if (zoomIndex) 
     1013    { 
     1014      buffer >> zoom_index_recv; 
     1015      global_zoom_index.reference(zoom_index_recv); 
     1016      zoom_index_tmp.resize(global_zoom_index.numElements()); 
     1017      std::copy(global_zoom_index.begin(), global_zoom_index.end(), zoom_index_tmp.begin()); 
     1018      std::sort(zoom_index_tmp.begin(), zoom_index_tmp.end()); 
     1019      itZoomBeginSrv = std::lower_bound(zoom_index_tmp.begin(), zoom_index_tmp.end(), begin_srv); 
     1020      itZoomEndSrv   = std::upper_bound(zoom_index_tmp.begin(), zoom_index_tmp.end(), end_srv);       
     1021      int sz = std::distance(itZoomBeginSrv, itZoomEndSrv); 
     1022      zoom_index_srv.resize(sz); 
     1023      itZoomSrv = itZoomBeginSrv; 
     1024      for (int i = 0; i < sz; ++i, ++itZoomSrv) 
     1025      { 
     1026        zoom_index_srv(i) = *(itZoomSrv); 
     1027      } 
     1028    } 
     1029 
    9651030    global_zoom_begin = global_zoom_begin_tmp; 
    9661031    global_zoom_n  = global_zoom_n_tmp; 
    9671032    int global_zoom_end = global_zoom_begin + global_zoom_n - 1; 
    9681033 
    969     zoom_begin_srv = global_zoom_begin > begin_srv ? global_zoom_begin : begin_srv ; 
    970     zoom_end_srv   = global_zoom_end < end_srv ? global_zoom_end : end_srv ; 
     1034    zoom_begin_srv = zoomIndex ? std::distance(itZoomBeginSrv, zoom_index_tmp.begin()) 
     1035                                 : global_zoom_begin > begin_srv ? global_zoom_begin : begin_srv ; 
     1036    zoom_end_srv   = zoomIndex ? std::distance(zoom_index_tmp.begin(), itZoomEndSrv) - 1  
     1037                                 : global_zoom_end < end_srv ? global_zoom_end : end_srv ; 
    9711038    zoom_size_srv  = zoom_end_srv - zoom_begin_srv + 1; 
     1039      
     1040    global_zoom_begin_srv = zoomIndex ? 0 : global_zoom_begin ; 
     1041    global_zoom_size_srv  = zoomIndex ? zoom_index_tmp.size() : global_zoom_n; 
    9721042 
    9731043    if (zoom_size_srv<=0) 
     
    9781048    if (n_glo == n) 
    9791049    { 
    980       zoom_begin_srv = global_zoom_begin; 
    981       zoom_end_srv   = global_zoom_end; //zoom_end; 
    982       zoom_size_srv  = zoom_end_srv - zoom_begin_srv + 1; 
     1050      zoom_begin_srv = zoomIndex ? std::distance(itZoomBeginSrv, zoom_index_tmp.begin()) 
     1051                                   : global_zoom_begin;       
     1052      zoom_size_srv  = zoomIndex ? zoom_index_tmp.size() 
     1053                                   : global_zoom_n; 
    9831054    } 
    9841055    if (hasValue) 
     
    10431114  } 
    10441115 
    1045  
    1046  
    10471116  void CAxis::duplicateTransformation(CAxis* src) 
    10481117  { 
  • XIOS/dev/branch_yushan_merged/src/node/axis.hpp

    r1134 r1205  
    122122        int zoom_begin_srv, zoom_end_srv, zoom_size_srv; 
    123123        int ni_srv, begin_srv, end_srv; 
     124        int global_zoom_begin_srv, global_zoom_end_srv, global_zoom_size_srv; 
    124125        CArray<double,1> value_srv; 
    125126        CArray<double,2> bound_srv; 
    126127        CArray<StdString,1> label_srv; 
     128        CArray<int,1> zoom_index_srv; 
    127129        bool hasValue; 
    128130 
     
    138140         void sendDistributedValue(); 
    139141         void sendNonDistributedValue(); 
     142         bool zoomByIndex(); 
    140143 
    141144         static void recvIndex(CEventServer& event); 
  • XIOS/dev/branch_yushan_merged/src/node/context.cpp

    r1160 r1205  
    1414#include "type.hpp" 
    1515#include "xios_spl.hpp" 
     16#include "timer.hpp" 
     17#include "memtrack.hpp" 
     18 
    1619 
    1720namespace xios { 
     
    278281   void CContext::setClientServerBuffer() 
    279282   { 
    280      size_t minBufferSize = CXios::minBufferSize; 
     283     // Estimated minimum event size for small events (10 is an arbitrary constant just for safety) 
     284     const size_t minEventSize = CEventClient::headerSize + getIdServer().size() + 10 * sizeof(int); 
     285     // Ensure there is at least some room for 20 of such events in the buffers 
     286     size_t minBufferSize = std::max(CXios::minBufferSize, 20 * minEventSize); 
    281287#define DECLARE_NODE(Name_, name_)    \ 
    282288     if (minBufferSize < sizeof(C##Name_##Definition)) minBufferSize = sizeof(C##Name_##Definition); 
     
    286292#undef DECLARE_NODE_PAR 
    287293 
     294     // Compute the buffer sizes needed to send the attributes and data corresponding to fields 
    288295     std::map<int, StdSize> maxEventSize; 
    289296     std::map<int, StdSize> bufferSize = getAttributesBufferSize(maxEventSize); 
     
    294301       if (it->second > bufferSize[it->first]) bufferSize[it->first] = it->second; 
    295302 
     303     // Apply the buffer size factor and check that we are above the minimum buffer size 
    296304     ite = bufferSize.end(); 
    297305     for (it = bufferSize.begin(); it != ite; ++it) 
     
    301309     } 
    302310 
    303      // We consider that the minimum buffer size is also the minimum event size 
    304      ite = maxEventSize.end(); 
    305      for (it = maxEventSize.begin(); it != ite; ++it) 
    306        if (it->second < minBufferSize) it->second = minBufferSize; 
    307  
     311     // Leaders will have to send some control events so ensure there is some room for those in the buffers 
    308312     if (client->isServerLeader()) 
    309313     { 
    310314       const std::list<int>& ranks = client->getRanksServerLeader(); 
    311315       for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    312          if (!bufferSize.count(*itRank)) bufferSize[*itRank] = maxEventSize[*itRank] = minBufferSize; 
     316       { 
     317         if (!bufferSize.count(*itRank)) 
     318         { 
     319           bufferSize[*itRank] = minBufferSize; 
     320           maxEventSize[*itRank] = minEventSize; 
     321         } 
     322       } 
    313323     } 
    314324 
     
    401411   void CContext::closeDefinition(void) 
    402412   { 
     413     CTimer::get("Context : close definition").resume() ; 
    403414     // There is nothing client need to send to server 
    404415     if (hasClient) 
     
    454465      startPrefetchingOfEnabledReadModeFiles(); 
    455466    } 
     467    CTimer::get("Context : close definition").suspend() ; 
    456468   } 
    457469 
     
    12061218   void CContext::updateCalendar(int step) 
    12071219   { 
     1220      #pragma omp critical (_output) 
     1221      {info(50) << "updateCalendar : before : " << calendar->getCurrentDate() << endl;} 
    12081222      calendar->update(step); 
    1209  
    1210  
     1223      #pragma omp critical (_output) 
     1224      {info(50) << "updateCalendar : after : " << calendar->getCurrentDate() << endl;} 
     1225#ifdef XIOS_MEMTRACK_LIGHT 
     1226      #pragma omp critical (_output) 
     1227      {info(50) << " Current memory used by XIOS : "<<  MemTrack::getCurrentMemorySize()*1.0/(1024*1024)<<" Mbyte, at timestep "<<step<<" of context "<<this->getId()<<endl ;} 
     1228#endif 
    12111229      if (hasClient) 
    12121230      { 
     
    12551273    CContext* context = CObjectFactory::CreateObject<CContext>(id).get(); 
    12561274    getRoot(); 
    1257     //if (!hasctxt) CGroupFactory::AddChild(root, context->getShared()); 
    12581275    if (!hasctxt) CGroupFactory::AddChild(*root_ptr, context->getShared()); 
    12591276 
  • XIOS/dev/branch_yushan_merged/src/node/field.cpp

    r1203 r1205  
    2626namespace xios{ 
    2727 
    28    /// ////////////////////// Dfinitions ////////////////////// /// 
     28   /// ////////////////////// Définitions ////////////////////// /// 
    2929 
    3030   CField::CField(void) 
     
    125125  void CField::sendUpdateData(const CArray<double,1>& data) 
    126126  { 
    127     CTimer::get("XIOS Send Data").resume(); 
     127    CTimer::get("Field : send data").resume(); 
    128128 
    129129    CContext* context = CContext::getCurrent(); 
     
    177177    } 
    178178 
    179     CTimer::get("XIOS Send Data").suspend(); 
     179    CTimer::get("Field : send data").suspend(); 
    180180  } 
    181181 
     
    187187    list<CEventServer::SSubEvent>::iterator it; 
    188188    string fieldId; 
    189  
     189    CTimer::get("Field : recv data").resume(); 
    190190    for (it = event.subEvents.begin(); it != event.subEvents.end(); ++it) 
    191191    { 
     
    197197    } 
    198198    get(fieldId)->recvUpdateData(ranks,buffers); 
     199    CTimer::get("Field : recv data").suspend(); 
    199200  } 
    200201 
     
    794795     if (!areAllReferenceSolved) solveAllReferenceEnabledField(false); 
    795796 
     797     const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
     798     const double defaultValue  = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 
     799 
    796800     // Start by building a filter which can provide the field's instant data 
    797801     if (!instantDataFilter) 
     
    810814           if (grid && grid != gridRef && grid->hasTransform()) 
    811815           { 
    812              bool hasMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
    813              double defaultValue  = hasMissingValue ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 
    814              std::pair<boost::shared_ptr<CFilter>, boost::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, hasMissingValue, defaultValue); 
     816             std::pair<boost::shared_ptr<CFilter>, boost::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, detectMissingValues, defaultValue); 
    815817 
    816818             filter->connectOutput(filters.first, 0); 
     
    828830         instantDataFilter = serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, 
    829831                                                                                                     freq_offset.isEmpty() ? NoneDu : freq_offset, 
    830                                                                                                      true)); 
     832                                                                                                     true, 
     833                                                                                                     detectMissingValues, defaultValue)); 
    831834       else // The data might be passed from the model 
    832835       { 
    833           bool ignoreMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
    834           double defaultValue  = ignoreMissingValue ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 
     836          if (check_if_active.isEmpty()) check_if_active = false; 
    835837          instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, NoneDu, false, 
    836                                                                                                       ignoreMissingValue, defaultValue));       } 
     838                                                                                                      detectMissingValues, defaultValue)); 
     839       } 
    837840     } 
    838841 
     
    842845       if (!read_access.isEmpty() && read_access) 
    843846       { 
    844          storeFilter = boost::shared_ptr<CStoreFilter>(new CStoreFilter(gc, CContext::getCurrent(), grid)); 
     847         storeFilter = boost::shared_ptr<CStoreFilter>(new CStoreFilter(gc, CContext::getCurrent(), grid, 
     848                                                                        detectMissingValues, defaultValue)); 
    845849         instantDataFilter->connectOutput(storeFilter, 0); 
    846850       } 
     
    903907     if (!selfReferenceFilter) 
    904908     { 
     909       const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
     910       const double defaultValue  = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 
     911 
    905912       if (file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read) 
    906913       { 
     
    908915           serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, 
    909916                                                                                   freq_offset.isEmpty() ? NoneDu : freq_offset, 
    910                                                                                    true)); 
     917                                                                                   true, 
     918                                                                                   detectMissingValues, defaultValue)); 
    911919 
    912920         selfReferenceFilter = serverSourceFilter; 
     
    922930         if (!clientSourceFilter) 
    923931         { 
    924            bool ignoreMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
    925            double defaultValue  = ignoreMissingValue ? default_value : (!default_value.isEmpty() ? default_value : 0.0);  
     932           if (check_if_active.isEmpty()) check_if_active = false; 
    926933           clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, NoneDu, false, 
    927                                                                                    ignoreMissingValue, defaultValue)); 
     934                                                                                   detectMissingValues, defaultValue)); 
    928935         } 
    929936 
     
    959966         freq_offset.setValue(NoneDu); 
    960967 
    961        const bool ignoreMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
    962  
     968       const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
     969        
    963970       boost::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, 
    964971                                                                             CContext::getCurrent()->getCalendar()->getInitDate(), 
    965972                                                                             freq_op, freq_offset, outFreq, 
    966                                                                              ignoreMissingValue, ignoreMissingValue ? default_value : 0.0)); 
     973                                                                             detectMissingValues, detectMissingValues ? default_value : 0.0)); 
    967974       instantDataFilter->connectOutput(temporalFilter, 0); 
    968975 
     
    9991006       if (freq_offset.isEmpty()) freq_offset.setValue(NoneDu); 
    10001007 
    1001        const bool ignoreMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
     1008       const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
    10021009 
    10031010       boost::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, 
    10041011                                                                             CContext::getCurrent()->getCalendar()->getInitDate(), 
    10051012                                                                             freq_op, freq_offset, outFreq, 
    1006                                                                              ignoreMissingValue, ignoreMissingValue ? default_value : 0.0)); 
     1013                                                                             detectMissingValues, detectMissingValues ? default_value : 0.0)); 
    10071014       selfReferenceFilter->connectOutput(temporalFilter, 0); 
    10081015       return temporalFilter ; 
  • XIOS/dev/branch_yushan_merged/src/node/field_impl.hpp

    r1007 r1205  
    1919  { 
    2020    if (clientSourceFilter) 
    21       clientSourceFilter->streamData(CContext::getCurrent()->getCalendar()->getCurrentDate(), _data); 
     21    { 
     22      if (!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/branch_yushan_merged/src/node/file.cpp

    r1172 r1205  
    1616#include "context_client.hpp" 
    1717#include "mpi.hpp" 
     18#include "timer.hpp" 
    1819 
    1920namespace xios { 
     
    274275      if (mode.isEmpty() || mode.getValue() == mode_attr::write) 
    275276      { 
     277        CTimer::get("Files : create headers").resume(); 
    276278        if (!isOpen) createHeader(); 
     279        CTimer::get("Files : create headers").suspend(); 
    277280        checkSync(); 
    278281      } 
    279282      else 
    280283      { 
     284        CTimer::get("Files : open headers").resume(); 
    281285        if (!isOpen) openInReadMode(); 
     286        CTimer::get("Files : open headers").suspend(); 
    282287      } 
    283288      checkSplit(); 
     
    395400         if (!split_freq.isEmpty()) 
    396401         { 
    397            CDate splitEnd = lastSplit + split_freq - 1 * Second; 
     402           CDate split_start ; 
     403           CDate splitEnd ; 
     404           if (!split_start_offset.isEmpty()) split_start=lastSplit + split_start_offset ; 
     405           else split_start=lastSplit ; 
     406 
     407           splitEnd = lastSplit + split_freq ; 
     408           if (!split_last_date.isEmpty()) 
     409           { 
     410             CDate splitLastDate=CDate::FromString(split_last_date,*CContext::getCurrent()->getCalendar()) ; 
     411             if( splitLastDate < splitEnd)  splitEnd=splitLastDate ; 
     412           } 
     413             
     414           if (!split_end_offset.isEmpty()) splitEnd = splitEnd + split_end_offset; 
     415           else splitEnd = splitEnd - 1 * Second; 
    398416 
    399417           string splitFormat; 
     
    410428 
    411429           oss << firstPart ; 
    412            if (hasStartDate) oss << lastSplit.getStr(splitFormat) ; 
     430           if (hasStartDate) oss << split_start.getStr(splitFormat) ; 
    413431           oss << middlePart ; 
    414432           if (hasEndDate) oss << splitEnd.getStr(splitFormat); 
  • XIOS/dev/branch_yushan_merged/src/node/grid.cpp

    r1134 r1205  
    12531253        std::vector<CAxis*> axisList = getAxis(); 
    12541254        std::vector<int> nZoomBegin(ssize), nZoomSize(ssize), nGlob(ssize), nZoomBeginGlobal(ssize); 
     1255        std::vector<CArray<int,1> > globalZoomIndex(numElement); 
    12551256        for (int i = 0; i < numElement; ++i) 
    12561257        { 
     
    12661267            nZoomBeginGlobal[indexMap[i] + 1] = domainList[domainId]->global_zoom_jbegin; 
    12671268            nGlob[indexMap[i] + 1] = domainList[domainId]->nj_glo; 
     1269 
     1270            { 
     1271              int count = 0; 
     1272              globalZoomIndex[i].resize(nZoomSize[indexMap[i]]*nZoomSize[indexMap[i]+1]); 
     1273              for (int jdx = 0; jdx < nZoomSize[indexMap[i]+1]; ++jdx) 
     1274                for (int idx = 0; idx < nZoomSize[indexMap[i]]; ++idx)                 
     1275                { 
     1276                  globalZoomIndex[i](count) = (nZoomBegin[indexMap[i]] + idx) + (nZoomBegin[indexMap[i]+1] + jdx) * nGlob[indexMap[i]]; 
     1277                  ++count; 
     1278                } 
     1279            } 
    12681280            ++domainId; 
    12691281          } 
     
    12721284            nZoomBegin[indexMap[i]] = axisList[axisId]->zoom_begin_srv; 
    12731285            nZoomSize[indexMap[i]]  = axisList[axisId]->zoom_size_srv; 
    1274             nZoomBeginGlobal[indexMap[i]] = axisList[axisId]->global_zoom_begin; 
     1286            nZoomBeginGlobal[indexMap[i]] = axisList[axisId]->global_zoom_begin_srv; 
    12751287            nGlob[indexMap[i]] = axisList[axisId]->n_glo; 
     1288            if (!axisList[axisId]->global_zoom_index.isEmpty()) 
     1289            { 
     1290              globalZoomIndex[i].reference(axisList[axisId]->zoom_index_srv);                 
     1291            } 
     1292            else 
     1293            { 
     1294              globalZoomIndex[i].resize(nZoomSize[indexMap[i]]); 
     1295              for (int idx = 0; idx < nZoomSize[indexMap[i]]; ++idx) 
     1296                globalZoomIndex[i](idx) = nZoomBegin[indexMap[i]] + idx; 
     1297            } 
     1298             
    12761299            ++axisId; 
    12771300          } 
     
    12821305            nZoomBeginGlobal[indexMap[i]] = 0; 
    12831306            nGlob[indexMap[i]] = 1; 
     1307            globalZoomIndex[i].resize(1); 
     1308            globalZoomIndex[i](0) = 0; 
    12841309            ++scalarId; 
    12851310          } 
     
    12891314          dataSize *= nZoomSize[i]; 
    12901315 
    1291         serverDistribution_ = new CDistributionServer(server->intraCommRank, nZoomBegin, nZoomSize, 
    1292                                                       nZoomBeginGlobal, nGlob); 
     1316/*        serverDistribution_ = new CDistributionServer(server->intraCommRank, nZoomBegin, nZoomSize, 
     1317                                                      nZoomBeginGlobal, nGlob);*/ 
     1318        serverDistribution_ = new CDistributionServer(server->intraCommRank,  
     1319                                                      globalZoomIndex, axis_domain_order, 
     1320                                                      nZoomBegin, nZoomSize, nZoomBeginGlobal, nGlob); 
    12931321      } 
    12941322 
  • XIOS/dev/branch_yushan_merged/src/node/zoom_axis.cpp

    r836 r1205  
    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.