Changeset 1169 for XIOS/trunk


Ignore:
Timestamp:
06/15/17 16:17:01 (7 years ago)
Author:
mhnguyen
Message:

Non-continuous zoom on axis
Zoomed points are defined by array index of zoom_axis

+) Update axis with new type of zoom

Test
+) On Curie
+) Work
+) Update test_complete with this new zoom.

Location:
XIOS/trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/bld.cfg

    r1140 r1169  
    3737#bld::target test_expand_domain.exe 
    3838#bld::target test_new_features.exe test_unstruct_complete.exe  
    39 bld::target test_client.exe #test_complete.exe test_xios2_cmip6.exe 
     39bld::target test_client.exe  
     40bld::target test_complete.exe test_xios2_cmip6.exe 
    4041#bld::target test_connectivity_expand.exe 
    4142#bld::target toy_cmip6.exe 
  • XIOS/trunk/inputs/COMPLETE/context_atmosphere.xml

    r787 r1169  
    1919  <axis_definition> 
    2020    <axis id="axis_atm"/> 
    21     <axis id="axis_atm_zoom" axis_ref="axis_atm"> 
    22       <zoom_axis id="axis_atm_zoom" n="4"/> 
     21    <axis id="axis_atm_zoom" axis_ref="axis_atm">       
     22      <zoom_axis id="axis_atm_zoom" index="(0,2)[3 0 1]"/> 
    2323    </axis> 
    2424  </axis_definition> 
  • XIOS/trunk/src/config/axis_attribute_private.conf

    r821 r1169  
    11DECLARE_ATTRIBUTE_PRIVATE(int, global_zoom_begin) 
    22DECLARE_ATTRIBUTE_PRIVATE(int, global_zoom_n) 
     3DECLARE_ARRAY_PRIVATE(int,  1, global_zoom_index) 
  • XIOS/trunk/src/config/zoom_axis_attribute.conf

    r787 r1169  
    22DECLARE_ATTRIBUTE(int,       begin) 
    33DECLARE_ATTRIBUTE(int,       n) 
     4DECLARE_ARRAY(int    ,1    , index) 
  • XIOS/trunk/src/distribution_server.cpp

    r930 r1169  
    3434} 
    3535 
     36CDistributionServer::CDistributionServer(int rank,  
     37                                        const std::vector<CArray<int,1> >& globalIndexElements, 
     38                                        const CArray<int,1>& elementOrder, 
     39                                        const std::vector<int>& nZoomBeginServer, 
     40                                        const std::vector<int>& nZoomSizeServer, 
     41                                        const std::vector<int>& nZoomBeginGlobal, 
     42                                        const std::vector<int>& nGlobal) 
     43  : CDistribution(rank, nGlobal.size()), nGlobal_(nGlobal), nZoomBeginGlobal_(nZoomBeginGlobal), 
     44    nZoomSize_(nZoomSizeServer), nZoomBegin_(nZoomBeginServer), globalLocalIndexMap_() 
     45{ 
     46  createGlobalIndex(globalIndexElements, elementOrder); 
     47} 
     48 
    3649CDistributionServer::~CDistributionServer() 
    3750{ 
     
    89102 
    90103/*! 
     104  Create global index on server side 
     105  Like the similar function on client side, this function serves on creating global index 
     106for data written by the server. The global index is used to calculating local index of data 
     107written on each server 
     108  \param[in] globalIndexElement global index on server side of each element of grid (scalar, axis, domain) 
     109  \param[in] elementOrder the order of elements of grid (e.x: domain->axis or domain->scalar) 
     110*/ 
     111void CDistributionServer::createGlobalIndex(const std::vector<CArray<int,1> >& globalIndexElements, 
     112                                            const CArray<int,1>& elementOrder) 
     113{ 
     114  int numElement = elementOrder.numElements(), elementIdx = 0;   
     115  std::vector<int> indexMap(numElement); 
     116  for (int i = 0; i < numElement; ++i) 
     117  { 
     118    indexMap[i] = elementIdx; 
     119    if (2 == elementOrder(i)) 
     120    {       
     121      elementIdx += 2; 
     122    } 
     123    else 
     124      ++elementIdx; 
     125  } 
     126 
     127  std::vector<size_t> elementGlobalSize(numElement); 
     128  size_t globalSize = 1; 
     129  for (int i = 0; i < numElement; ++i) 
     130  { 
     131    int elementType = elementOrder(i); 
     132    elementGlobalSize[i] = globalSize; 
     133    if (2 == elementType) // domain 
     134    { 
     135      globalSize *= nGlobal_[indexMap[i]+1] * nGlobal_[indexMap[i]]; 
     136    } 
     137    else // axis or scalar 
     138    { 
     139      globalSize *= nGlobal_[indexMap[i]]; 
     140    } 
     141  }  
     142 
     143  size_t ssize = 1; 
     144  for (int i = 0; i < globalIndexElements.size(); ++i) ssize *= globalIndexElements[i].numElements(); 
     145  this->globalIndex_.resize(ssize); 
     146  globalLocalIndexMap_.rehash(std::ceil(ssize/globalLocalIndexMap_.max_load_factor())); 
     147 
     148  std::vector<int> idxLoop(numElement,0); 
     149  std::vector<int> currentIndex(numElement); 
     150  int innerLoopSize = globalIndexElements[0].numElements(); 
     151 
     152  size_t idx = 0; 
     153  while (idx<ssize) 
     154  { 
     155    for (int i = 0; i < numElement-1; ++i) 
     156    { 
     157      if (idxLoop[i] == globalIndexElements[i].numElements()) 
     158      { 
     159        idxLoop[i] = 0; 
     160        ++idxLoop[i+1]; 
     161      } 
     162    } 
     163 
     164    for (int i = 1; i < numElement; ++i)  currentIndex[i] = globalIndexElements[i](idxLoop[i]); 
     165 
     166    size_t mulDim, globalIndex; 
     167    for (int i = 0; i < innerLoopSize; ++i) 
     168    {       
     169      globalIndex = 0; 
     170      currentIndex[0] = globalIndexElements[0](i); 
     171 
     172      for (int k = 0; k < numElement; ++k) 
     173      {      
     174        globalIndex += (currentIndex[k])*elementGlobalSize[k]; 
     175      } 
     176      globalLocalIndexMap_[globalIndex] = idx; 
     177      this->globalIndex_(idx) = globalIndex; 
     178      ++idx; 
     179    } 
     180    idxLoop[0] += innerLoopSize; 
     181  } 
     182} 
     183 
     184/*! 
    91185  Compute local index for writing data on server 
    92186  \param [in] globalIndex global index received from client 
  • XIOS/trunk/src/distribution_server.hpp

    r930 r1169  
    3131                        const std::vector<int>& nGlobal); 
    3232 
     33    CDistributionServer(int rank,  
     34                        const std::vector<CArray<int,1> >& globalIndexElements, 
     35                        const CArray<int,1>& elementOrder, 
     36                        const std::vector<int>& nZoomBeginServer, 
     37                        const std::vector<int>& nZoomSizeServer, 
     38                        const std::vector<int>& nZoomBeginGlobal, 
     39                        const std::vector<int>& nGlobal); 
     40 
    3341    /** Default destructor */ 
    3442    virtual ~CDistributionServer(); 
     
    4452  protected: 
    4553    virtual void createGlobalIndex(); 
     54    void createGlobalIndex(const std::vector<CArray<int,1> >& globalIndexElements, 
     55                           const CArray<int,1>& elementOrder); 
    4656 
    4757  protected: 
  • XIOS/trunk/src/io/nc4_data_output.cpp

    r1135 r1169  
    10441044        int zoom_begin_srv = axis->zoom_begin_srv; 
    10451045        int zoom_size  = (MULTI_FILE == SuperClass::type) ? zoom_size_srv 
    1046                                                               : axis->global_zoom_n; 
    1047         int zoom_begin = (MULTI_FILE == SuperClass::type) ? zoom_begin_srv 
    1048                                                               : axis->global_zoom_begin; 
     1046                                                          : axis->global_zoom_size_srv; 
    10491047 
    10501048        if ((0 == zoom_size_srv) && (MULTI_FILE == SuperClass::type)) return; 
     
    11251123                std::vector<StdSize> start(1), startBounds(2) ; 
    11261124                std::vector<StdSize> count(1), countBounds(2) ; 
    1127                 start[0] = startBounds[0] = zoom_begin_srv-axis->global_zoom_begin; 
     1125                start[0] = startBounds[0] = zoom_begin_srv-axis->global_zoom_begin_srv; 
    11281126                count[0] = countBounds[0] = zoom_size_srv; 
    11291127                startBounds[1] = 0; 
  • XIOS/trunk/src/node/axis.cpp

    r1117 r1169  
    354354    // We don't check if the mask is valid here, just if a mask has been defined at this point. 
    355355    isCompressible_ = !mask.isEmpty(); 
     356  } 
     357 
     358  bool CAxis::zoomByIndex() 
     359  { 
     360    return (!global_zoom_index.isEmpty() && (0 != global_zoom_index.numElements())); 
    356361  } 
    357362 
     
    450455    size_t nZoomCount = 0; 
    451456    size_t nbIndex = index.numElements(); 
    452     for (size_t idx = 0; idx < nbIndex; ++idx) 
     457 
     458    int end = (0 == n) ? begin : begin + n - 1; 
     459    int zoom_size = zoomByIndex() ? global_zoom_index.numElements() : global_zoom_n; 
     460    int minInd = min(index); 
     461    int maxInd = max(index); 
     462    for (size_t idx = 0; idx < zoom_size; ++idx) 
     463    { 
     464      size_t globalZoomIndex = zoomByIndex() ? global_zoom_index(idx) : global_zoom_begin + idx; 
     465      if (globalZoomIndex >= minInd && globalZoomIndex <= maxInd) ++nZoomCount; 
     466    } 
     467 
     468/*    for (size_t idx = 0; idx < nbIndex; ++idx) 
    453469    { 
    454470      size_t globalIndex = index(idx); 
    455471      if (globalIndex >= global_zoom_begin && globalIndex <= zoom_end) ++nZoomCount; 
    456     } 
    457  
     472    }*/ 
     473     
    458474    CArray<size_t,1> globalIndexAxis(nbIndex); 
     475    for (size_t idx = 0; idx < nbIndex; ++idx) 
     476    {       
     477      globalIndexAxis(idx) = (size_t)index(idx); 
     478    } 
     479 
    459480    std::vector<size_t> globalAxisZoom(nZoomCount); 
    460481    nZoomCount = 0; 
    461     for (size_t idx = 0; idx < nbIndex; ++idx) 
    462     { 
    463       size_t globalIndex = index(idx); 
    464       globalIndexAxis(idx) = globalIndex; 
    465       if (globalIndex >= global_zoom_begin && globalIndex <= zoom_end) 
    466       { 
    467         globalAxisZoom[nZoomCount] = globalIndex; 
     482    for (size_t idx = 0; idx < zoom_size; ++idx) 
     483    { 
     484      size_t globalZoomIndex = zoomByIndex() ? global_zoom_index(idx) : global_zoom_begin + idx; 
     485      if (globalZoomIndex >= minInd && globalZoomIndex <= maxInd) 
     486      { 
     487        globalAxisZoom[nZoomCount] = globalZoomIndex; 
    468488        ++nZoomCount; 
    469       } 
     489      }  
    470490    } 
    471491 
     
    585605    int zoom_end = global_zoom_begin + global_zoom_n - 1; 
    586606    int nb = 0; 
    587     for (size_t idx = 0; idx < n; ++idx) 
     607/*    for (size_t idx = 0; idx < n; ++idx) 
    588608    { 
    589609      size_t globalIndex = begin + idx; 
    590610      if (globalIndex >= global_zoom_begin && globalIndex <= zoom_end) ++nb; 
     611    }*/ 
     612 
     613    int end = (0 == n) ? begin : begin + n - 1; 
     614    int zoom_size = zoomByIndex() ? global_zoom_index.numElements() : global_zoom_n; 
     615    for (size_t idx = 0; idx < zoom_size; ++idx) 
     616    { 
     617      size_t globalZoomIndex = zoomByIndex() ? global_zoom_index(idx) : global_zoom_begin + idx; 
     618      if (globalZoomIndex >= begin && globalZoomIndex <= end) ++nb; 
    591619    } 
    592620 
     
    609637    CArray<double,1> val(nb); 
    610638    nb = 0; 
    611     for (size_t idx = 0; idx < n; ++idx) 
     639/*    for (size_t idx = 0; idx < n; ++idx) 
    612640    { 
    613641      size_t globalIndex = begin + idx; 
     
    615643      { 
    616644        val(nb) = value(idx); 
     645        ++nb; 
     646      } 
     647    }*/ 
     648 
     649    for (size_t idx = 0; idx < zoom_size; ++idx) 
     650    { 
     651      size_t globalZoomIndex = zoomByIndex() ? global_zoom_index(idx) : global_zoom_begin + idx; 
     652      if (globalZoomIndex >= begin && globalZoomIndex <= end) 
     653      { 
     654        val(nb) = value(globalZoomIndex-begin); 
    617655        ++nb; 
    618656      } 
     
    920958        const int ni    = serverDimensionSizes[*itRank][orderPositionInGrid]; 
    921959        const int end   = begin + ni - 1; 
     960        const bool zoomIndex = zoomByIndex(); 
    922961 
    923962        msgs.push_back(CMessage()); 
     
    926965        msg << ni << begin << end; 
    927966        msg << global_zoom_begin.getValue() << global_zoom_n.getValue(); 
    928         msg << isCompressible_; 
     967        msg << isCompressible_;         
     968        msg << zoomIndex; 
     969        if (zoomIndex) 
     970          msg << global_zoom_index.getValue(); 
    929971 
    930972        event.push(*itRank,1,msg); 
     
    946988  { 
    947989    int ni_srv, begin_srv, end_srv, global_zoom_begin_tmp, global_zoom_n_tmp; 
     990    bool zoomIndex;     
     991    CArray<int,1> zoom_index_recv; 
     992    std::vector<int> zoom_index_tmp; 
     993    std::vector<int>::iterator itZoomBeginSrv, itZoomEndSrv, itZoomSrv; 
    948994 
    949995    buffer >> ni_srv >> begin_srv >> end_srv; 
    950996    buffer >> global_zoom_begin_tmp >> global_zoom_n_tmp; 
    951997    buffer >> isCompressible_; 
     998    buffer >> zoomIndex; 
     999    if (zoomIndex) 
     1000    { 
     1001      buffer >> zoom_index_recv; 
     1002      global_zoom_index.reference(zoom_index_recv); 
     1003      zoom_index_tmp.resize(global_zoom_index.numElements()); 
     1004      std::copy(global_zoom_index.begin(), global_zoom_index.end(), zoom_index_tmp.begin()); 
     1005      std::sort(zoom_index_tmp.begin(), zoom_index_tmp.end()); 
     1006      itZoomBeginSrv = std::lower_bound(zoom_index_tmp.begin(), zoom_index_tmp.end(), begin_srv); 
     1007      itZoomEndSrv   = std::upper_bound(zoom_index_tmp.begin(), zoom_index_tmp.end(), end_srv);       
     1008      int sz = std::distance(itZoomBeginSrv, itZoomEndSrv); 
     1009      zoom_index_srv.resize(sz); 
     1010      itZoomSrv = itZoomBeginSrv; 
     1011      for (int i = 0; i < sz; ++i, ++itZoomSrv) 
     1012      { 
     1013        zoom_index_srv(i) = *(itZoomSrv); 
     1014      } 
     1015    } 
     1016 
    9521017    global_zoom_begin = global_zoom_begin_tmp; 
    9531018    global_zoom_n  = global_zoom_n_tmp; 
    9541019    int global_zoom_end = global_zoom_begin + global_zoom_n - 1; 
    9551020 
    956     zoom_begin_srv = global_zoom_begin > begin_srv ? global_zoom_begin : begin_srv ; 
    957     zoom_end_srv   = global_zoom_end < end_srv ? global_zoom_end : end_srv ; 
     1021    zoom_begin_srv = zoomIndex ? std::distance(itZoomBeginSrv, zoom_index_tmp.begin()) 
     1022                                 : global_zoom_begin > begin_srv ? global_zoom_begin : begin_srv ; 
     1023    zoom_end_srv   = zoomIndex ? std::distance(zoom_index_tmp.begin(), itZoomEndSrv) - 1  
     1024                                 : global_zoom_end < end_srv ? global_zoom_end : end_srv ; 
    9581025    zoom_size_srv  = zoom_end_srv - zoom_begin_srv + 1; 
     1026      
     1027    global_zoom_begin_srv = zoomIndex ? 0 : global_zoom_begin ; 
     1028    global_zoom_size_srv  = zoomIndex ? zoom_index_tmp.size() : global_zoom_n; 
    9591029 
    9601030    if (zoom_size_srv<=0) 
     
    9651035    if (n_glo == n) 
    9661036    { 
    967       zoom_begin_srv = global_zoom_begin; 
    968       zoom_end_srv   = global_zoom_end; //zoom_end; 
    969       zoom_size_srv  = zoom_end_srv - zoom_begin_srv + 1; 
     1037      zoom_begin_srv = zoomIndex ? std::distance(itZoomBeginSrv, zoom_index_tmp.begin()) 
     1038                                   : global_zoom_begin;       
     1039      zoom_size_srv  = zoomIndex ? zoom_index_tmp.size() 
     1040                                   : global_zoom_n; 
    9701041    } 
    9711042    if (hasValue) 
  • XIOS/trunk/src/node/axis.hpp

    r1106 r1169  
    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/trunk/src/node/grid.cpp

    r1093 r1169  
    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/trunk/src/node/zoom_axis.cpp

    r836 r1169  
    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); 
  • XIOS/trunk/src/transformation/axis_algorithm_zoom.cpp

    r933 r1169  
    4444  zoomBegin_ = zoomAxis->begin.getValue(); 
    4545  zoomSize_  = zoomAxis->n.getValue(); 
    46   zoomEnd_   = zoomBegin_ + zoomSize_ - 1; 
     46  zoomEnd_   = zoomBegin_ + zoomSize_ - 1;   
    4747 
    4848  if (zoomSize_ > axisSource->n_glo.getValue()) 
     
    5353           << "Zoom size is " << zoomSize_ ); 
    5454  } 
     55 
     56  if (!zoomAxis->index.isEmpty()) 
     57  { 
     58    int sz = zoomAxis->index.numElements(); 
     59    zoomIndex_.resize(sz); 
     60    for (int i = 0; i < sz; ++i) 
     61      zoomIndex_[i] = zoomAxis->index(i); 
     62 
     63    std::sort(zoomIndex_.begin(), zoomIndex_.end()); 
     64  } 
    5565} 
    5666 
     
    6070void CAxisAlgorithmZoom::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs) 
    6171{ 
     72  this->transformationMapping_.resize(1); 
     73  this->transformationWeight_.resize(1); 
     74 
     75  TransformationIndexMap& transMap = this->transformationMapping_[0]; 
     76  TransformationWeightMap& transWeight = this->transformationWeight_[0]; 
     77 
    6278  StdSize niSource = axisSrc_->n.getValue(); 
    6379  StdSize ibeginSource = axisSrc_->begin.getValue(); 
     
    6985  if (iend < ibegin) ni = 0; 
    7086 
    71   this->transformationMapping_.resize(1); 
    72   this->transformationWeight_.resize(1); 
    73  
    74   TransformationIndexMap& transMap = this->transformationMapping_[0]; 
    75   TransformationWeightMap& transWeight = this->transformationWeight_[0]; 
    76  
    77   for (StdSize idx = 0; idx < ni; ++idx) 
     87  if (!zoomIndex_.empty()) 
    7888  { 
    79     transMap[ibegin+idx].push_back(ibegin+idx); 
    80     transWeight[ibegin+idx].push_back(1.0); 
     89    std::vector<int>::iterator itZoomBegin, itZoomEnd; 
     90    itZoomBegin = std::lower_bound(zoomIndex_.begin(), zoomIndex_.end(), ibeginSource); 
     91    itZoomEnd   = std::upper_bound(zoomIndex_.begin(), zoomIndex_.end(), iendSource);             
     92    for (; itZoomBegin != itZoomEnd; ++itZoomBegin) 
     93    { 
     94      transMap[*itZoomBegin].push_back(*itZoomBegin); 
     95      transWeight[*itZoomBegin].push_back(1.0); 
     96    } 
     97  } 
     98  else 
     99  { 
     100    for (StdSize idx = 0; idx < ni; ++idx) 
     101    { 
     102      transMap[ibegin+idx].push_back(ibegin+idx); 
     103      transWeight[ibegin+idx].push_back(1.0); 
     104    } 
    81105  } 
    82106 
     
    92116  axisDest_->global_zoom_begin = zoomBegin_; 
    93117  axisDest_->global_zoom_n  = zoomSize_; 
     118  if (!zoomIndex_.empty()) 
     119  { 
     120    axisDest_->global_zoom_index.resize(zoomIndex_.size()); 
     121    std::copy(zoomIndex_.begin(), zoomIndex_.end(), axisDest_->global_zoom_index.begin()); 
     122  } 
    94123} 
    95124 
  • XIOS/trunk/src/transformation/axis_algorithm_zoom.hpp

    r933 r1169  
    4848  StdSize zoomSize_; 
    4949 
     50  std::vector<int> zoomIndex_; 
     51 
    5052private: 
    5153 
Note: See TracChangeset for help on using the changeset viewer.