Changeset 666 for XIOS/trunk/src/node


Ignore:
Timestamp:
08/24/15 14:53:27 (9 years ago)
Author:
mhnguyen
Message:

Change name of several axis attributes and remove some redundant variable of domain

+) Change name of axis attributes to make them consistent with ones of domain
+) Remove zoom_client_* of domain

Test
+) On Curie
+) All tests pass and are correct

Location:
XIOS/trunk/src/node
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/node/axis.cpp

    r657 r666  
    7676   void CAxis::checkAttributes(void) 
    7777   { 
    78       if (this->size.isEmpty()) 
     78      if (this->n_glo.isEmpty()) 
    7979         ERROR("CAxis::checkAttributes(void)", 
    80                << "Attribute <size> of the axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] must be specified"); 
    81       StdSize size = this->size.getValue(); 
    82  
    83       isDistributed_ = !this->ibegin.isEmpty() || !this->ni.isEmpty(); 
    84  
    85       if (!this->ibegin.isEmpty()) 
    86       { 
    87         StdSize ibegin = this->ibegin.getValue(); 
     80               << "Attribute <n_glo> of the axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] must be specified"); 
     81      StdSize size = this->n_glo.getValue(); 
     82 
     83      isDistributed_ = !this->begin.isEmpty() || !this->n.isEmpty(); 
     84 
     85      if (!this->begin.isEmpty()) 
     86      { 
     87        StdSize ibegin = this->begin.getValue(); 
    8888        if ((ibegin < 0) || (ibegin > size-1)) 
    8989          ERROR("CAxis::checkAttributes(void)", 
    9090                << "Attribute <ibegin> of the axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] must be non-negative and smaller than size-1"); 
    9191      } 
    92       else this->ibegin.setValue(0); 
    93  
    94       if (!this->ni.isEmpty()) 
    95       { 
    96         StdSize ni = this->ni.getValue(); 
     92      else this->begin.setValue(0); 
     93 
     94      if (!this->n.isEmpty()) 
     95      { 
     96        StdSize ni = this->n.getValue(); 
    9797        if ((ni < 0) || (ni > size)) 
    9898          ERROR("CAxis::checkAttributes(void)", 
    9999                << "Attribute <ni> of the axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] must be non-negative and smaller than size"); 
    100100      } 
    101       else this->ni.setValue(size); 
     101      else this->n.setValue(size); 
    102102 
    103103      StdSize true_size = value.numElements(); 
    104       if (this->ni.getValue() != true_size) 
     104      if (this->n.getValue() != true_size) 
    105105         ERROR("CAxis::checkAttributes(void)", 
    106106               << "The array \'value\' of axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] has a different size that the one defined by the \'size\' attribute"); 
     
    121121      } 
    122122      else if (data_n.isEmpty()) 
    123         data_n.setValue(ni.getValue()); 
     123        data_n.setValue(n.getValue()); 
    124124 
    125125      if (data_index.isEmpty()) 
     
    127127        int dn = data_n.getValue(); 
    128128        data_index.resize(dn); 
    129         for (int i = 0; i < dn; ++i) data_index(i) = (i+1); 
     129        for (int i = 0; i < dn; ++i) data_index(i) = i; 
    130130      } 
    131131   } 
     
    133133   void CAxis::checkZoom(void) 
    134134   { 
    135      if (0 == global_zoom_size) global_zoom_size = this->size.getValue(); 
     135     if (0 == global_zoom_size) global_zoom_size = this->n_glo.getValue(); 
    136136   } 
    137137 
    138138   void CAxis::checkMask() 
    139139   { 
    140       int begin_mask = 0, 
    141           end_mask = ni.getValue()-1; 
    142  
    143       if (!zoom_begin.isEmpty()) 
    144       { 
    145          int zoom_end = zoom_begin.getValue() + zoom_size.getValue() - 1; 
    146  
    147          begin_mask = std::max(ibegin.getValue(), zoom_begin.getValue()); 
    148          end_mask   = std::min(ibegin.getValue() + ni.getValue()-1, zoom_end); 
    149  
    150          begin_mask -= ibegin.getValue(); 
    151          end_mask   -= ibegin.getValue(); 
    152       } 
    153  
    154  
    155140      if (!mask.isEmpty()) 
    156141      { 
    157          if (mask.extent(0) != ni) 
     142         if (mask.extent(0) != n) 
    158143            ERROR("CAxis::checkMask(void)", 
    159144                  << "the mask has not the same size than the local axis" << endl 
    160                   << "Local size is " << ni << "x" << endl 
     145                  << "Local size is " << n << "x" << endl 
    161146                  << "Mask size is " << mask.extent(0) << "x"); 
    162          for (int i = 0; i < ni; ++i) 
    163          { 
    164            if (i < begin_mask && i > end_mask)  mask(i) = false; 
    165          } 
    166147      } 
    167148      else // (!mask.hasValue()) 
    168149      { // Si aucun masque n'est défini, 
    169150        // on en crée un nouveau qui valide l'intégralité du domaine. 
    170          mask.resize(ni); 
    171          for (int i = 0; i < ni.getValue(); ++i) 
     151         mask.resize(n); 
     152         for (int i = 0; i < n.getValue(); ++i) 
    172153         { 
    173                if (i >= begin_mask && i <= end_mask) 
    174                  mask(i) = true; 
    175                else  mask(i) = false; 
     154           mask(i) = true; 
    176155         } 
    177156      } 
     
    182161    if (!bounds.isEmpty()) 
    183162    { 
    184       if (bounds.extent(0) != ni || bounds.extent(1) != 2) 
     163      if (bounds.extent(0) != n || bounds.extent(1) != 2) 
    185164          ERROR("CAxis::checkAttributes(void)", 
    186165                << "The bounds array of the axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] must be of dimension axis size x 2" << endl 
    187                 << "Axis size is " << ni << endl 
     166                << "Axis size is " << n << endl 
    188167                << "Bounds size is "<< bounds.extent(0) << " x " << bounds.extent(1)); 
    189168      hasBounds_ = true; 
     
    255234  void CAxis::sendValue() 
    256235  { 
    257      if (ni.getValue() == size.getValue()) 
     236     if (n.getValue() == n_glo.getValue()) 
    258237     { 
    259238       sendNonDistributedValue(); 
     
    272251    int nbServer = client->serverSize; 
    273252    int range, clientSize = client->clientSize; 
     253    size_t ni = this->n.getValue(); 
     254    size_t ibegin = this->begin.getValue(); 
    274255 
    275256    CArray<size_t,1> globalIndexAxis(ni); 
    276     size_t ibegin = this->ibegin.getValue(); 
    277257    int zoom_end = global_zoom_begin+global_zoom_size-1; 
    278258    std::vector<size_t> globalAxisZoom; 
     
    285265 
    286266    std::vector<int> nGlobDomain(1); 
    287     nGlobDomain[0] = size.getValue(); 
     267    nGlobDomain[0] = n_glo.getValue(); 
    288268 
    289269    size_t globalSizeIndex = 1, indexBegin, indexEnd; 
     
    348328    int zoom_end = global_zoom_begin+global_zoom_size-1; 
    349329    int nb =0; 
    350     for (size_t idx = 0; idx < ni; ++idx) 
    351     { 
    352       size_t globalIndex = ibegin + idx; 
     330    for (size_t idx = 0; idx < n; ++idx) 
     331    { 
     332      size_t globalIndex = begin + idx; 
    353333      if (globalIndex >= global_zoom_begin && globalIndex <= zoom_end) ++nb; 
    354334    } 
     
    356336    CArray<double,1> val(nb); 
    357337    nb = 0; 
    358     for (size_t idx = 0; idx < ni; ++idx) 
    359     { 
    360       size_t globalIndex = ibegin + idx; 
     338    for (size_t idx = 0; idx < n; ++idx) 
     339    { 
     340      size_t globalIndex = begin + idx; 
    361341      if (globalIndex >= global_zoom_begin && globalIndex <= zoom_end) 
    362342      { 
     
    424404      { 
    425405        idx = static_cast<int>(it->second[n]); 
    426         ind = idx - ibegin; 
     406        ind = idx - begin; 
    427407 
    428408        val(n) = value(ind); 
     
    602582    } 
    603583 
    604     if (size == ni) 
     584    if (n_glo == n) 
    605585    { 
    606586      zoom_begin_srv = global_zoom_begin; 
  • XIOS/trunk/src/node/domain.cpp

    r665 r666  
    138138     checkLocalIDomain(); 
    139139     checkLocalJDomain(); 
    140  
    141      ibegin_client = ibegin; ni_client = ni; iend_client = ibegin + ni - 1; 
    142      jbegin_client = jbegin; nj_client = nj; jend_client = jbegin + nj - 1; 
    143140 
    144141     if (i_index.isEmpty()) 
     
    340337            data_i_index.resize(dni) ; 
    341338            data_j_index.resize(dni) ; 
    342             data_n_index.setValue(dni); 
     339 
    343340            for (int i = 0; i < dni; ++i) 
    344341            { 
     
    353350            data_j_index.resize(dni) ; 
    354351 
    355             data_n_index.setValue(dni); 
    356  
    357352            for(int count = 0, j = 0; j  < data_nj.getValue(); ++j) 
    358353            { 
     
    367362   } 
    368363 
    369    void CDomain::completeLonClient() 
     364   //---------------------------------------------------------------- 
     365   void CDomain::completeLonLatClient(void) 
    370366   { 
    371367     int i,j,k ; 
    372368     CArray<double,1> lonvalue_temp(ni*nj) ; 
    373369     CArray<double,2> bounds_lon_temp(nvertex,ni*nj); 
    374  
    375      if (!lonvalue_1d.isEmpty() && !lonvalue_2d.isEmpty()) 
    376        ERROR("CDomain::completeLonLatClient(void)", 
    377             <<"Only one longitude value can be used but both lonvalue_1d and lonvalue_2d are defined! "<<endl 
    378             <<"Define only one longitude value: lonvalue_1d or lonvalue_2d "); 
    379  
    380      if (!lonvalue_1d.isEmpty() && lonvalue_2d.isEmpty()) 
    381      { 
    382        if (lonvalue_1d.numElements() != i_index.numElements()) 
    383          ERROR("CDomain::completeLonLatClient(void)", 
    384                <<"lonvalue_1d has not the same size as the local domain"<<endl 
    385                <<"Local size is "<<i_index.numElements()<<endl 
    386                <<"lonvalue_1d size is "<<lonvalue_1d.numElements()); 
    387      } 
    388  
    389      if (lonvalue_1d.isEmpty() && !lonvalue_2d.isEmpty()) 
    390      { 
    391         if ((lonvalue_2d.extent(0) != ni) || 
    392             (lonvalue_2d.extent(1) != nj)) 
    393            ERROR("CDomain::completeLonLatClient(void)", 
    394                  <<"the lonvalue has not the same size as the local domain"<<endl 
    395                  <<"Local size is "<<ni<<"x"<<nj<<endl 
    396                  <<"Lonvalue size is "<<lonvalue_2d.extent(0)<<"x"<<lonvalue_2d.extent(1)); 
    397      } 
     370     CArray<double,1> latvalue_temp(ni*nj) ; 
     371     CArray<double,2> bounds_lat_temp(nvertex,ni*nj); 
    398372 
    399373     if (!lonvalue_2d.isEmpty()) 
     
    403377          { 
    404378            lonvalue_temp(i+j*ni) = lonvalue_2d(i,j); 
     379            latvalue_temp(i+j*ni) = latvalue_2d(i,j); 
    405380            if (hasBounds) 
    406381            { 
    407382              k=j*ni+i; 
    408               for(int n=0;n<nvertex;++n) bounds_lon_temp(n,k) = bounds_lon_2d(n,i,j); 
     383              for(int n=0;n<nvertex;++n) 
     384              { 
     385                bounds_lon_temp(n,k) = bounds_lon_2d(n,i,j); 
     386                bounds_lat_temp(n,k) = bounds_lat_2d(n,i,j); 
     387              } 
    409388            } 
    410389          } 
     
    415394       if (type_attr::rectilinear == type) 
    416395       { 
    417          if (ni == lonvalue_1d.numElements()) 
     396         if ((ni == lonvalue_1d.numElements()) && (nj == latvalue_1d.numElements())) 
    418397         { 
    419398           for(j=0;j<nj;++j) 
     
    422401               k=j*ni+i; 
    423402               lonvalue_temp(k) = lonvalue_1d(i); 
     403               latvalue_temp(k) = latvalue_1d(j); 
    424404               if (hasBounds) 
    425405               { 
    426                  for(int n=0;n<nvertex;++n) bounds_lon_temp(n,k) = bounds_lon_1d(n,i); 
     406                 for(int n=0;n<nvertex;++n) 
     407                 { 
     408                   bounds_lon_temp(n,k) = bounds_lon_1d(n,i); 
     409                   bounds_lat_temp(n,k) = bounds_lat_1d(n,j); 
     410                 } 
    427411               } 
    428412             } 
     
    430414          else 
    431415            ERROR("CDomain::completeLonClient(void)", 
    432                  <<"The lonvalue_1d has not the same size as the local domain"<<endl 
    433                  <<"Local size is "<<ni<<endl 
    434                  <<"Lonvalue_1d size is "<<lonvalue_1d.numElements()); 
     416                 <<"lonvalue_1d and latvalue_1d has not the same size as the local domain"<<endl 
     417                 <<"Local size is "<<ni<<"x " << nj<< endl 
     418                 <<"lonvalue_1d size is "<<lonvalue_1d.numElements() 
     419                 <<"latvalue_1d size is "<<latvalue_1d.numElements()); 
    435420       } 
    436421       else if (type==type_attr::curvilinear || type==type_attr::unstructured) 
    437422       { 
    438423         lonvalue_temp=lonvalue_1d; 
     424         latvalue_temp=latvalue_1d; 
    439425         if (hasBounds) 
    440426         { 
    441427           bounds_lon_temp=bounds_lon_1d; 
    442          } 
    443        } 
    444      } 
    445  
    446      StdSize dm = zoom_ni_client * zoom_nj_client; 
    447  
    448       // Make sure that this attribute is non-empty for every client. 
    449      if (0 != dm) 
    450      { 
    451        lonvalue_client.resize(dm); 
    452        if (hasBounds) bounds_lon_client.resize(nvertex, dm); 
    453      } 
    454  
    455  
    456      for (i = 0; i < zoom_ni_client; ++i) 
    457      { 
    458        for (j = 0; j < zoom_nj_client; ++j) 
    459        { 
    460          lonvalue_client(i + j * zoom_ni_client) = lonvalue_temp( (i + zoom_ibegin_client-ibegin) + (j + zoom_jbegin_client -jbegin)*ni ); 
    461          if (hasBounds) 
    462          { 
    463            for(int n=0;n<nvertex;n++) 
    464            { 
    465              bounds_lon_client(n,i + j * zoom_ni_client) = bounds_lon_temp( n, (i + zoom_ibegin_client - ibegin) + (j + zoom_jbegin_client -jbegin)*ni ); 
    466            } 
    467          } 
    468        } 
    469      } 
    470    } 
    471  
    472    void CDomain::completeLatClient() 
    473    { 
    474      int i,j,k; 
    475      CArray<double,1> latvalue_temp(ni*nj) ; 
    476      CArray<double,2> bounds_lat_temp(nvertex,ni*nj); 
    477  
    478      if (!latvalue_1d.isEmpty() && !latvalue_2d.isEmpty()) 
    479        ERROR("CDomain::completeLonLatClient(void)", 
    480             <<"Only one longitude value can be used but both latvalue_1d and latvalue_2d are defined! "<<endl 
    481             <<"Define only one longitude value: latvalue_1d or latvalue_2d "); 
    482  
    483      if (!latvalue_1d.isEmpty() && latvalue_2d.isEmpty()) 
    484      { 
    485        if (latvalue_1d.numElements() != i_index.numElements()) 
    486          ERROR("CDomain::completeLonLatClient(void)", 
    487                <<"the latvalue_1d has not the same size as the local domain"<<endl 
    488                <<"Local size is "<<i_index.numElements()<<endl 
    489                <<"Mask size is "<<latvalue_1d.numElements()); 
    490      } 
    491  
    492      if (latvalue_1d.isEmpty() && !latvalue_2d.isEmpty()) 
    493      { 
    494         if ((latvalue_2d.extent(0) != ni) || 
    495             (latvalue_2d.extent(1) != nj)) 
    496            ERROR("CDomain::completeLonLatClient(void)", 
    497                  <<"the mask has not the same size as the local domain"<<endl 
    498                  <<"Local size is "<<ni<<"x"<<nj<<endl 
    499                  <<"Mask size is "<<latvalue_2d.extent(0)<<"x"<<latvalue_2d.extent(1)); 
    500      } 
    501  
    502      if (!latvalue_2d.isEmpty()) 
    503      { 
    504         for (j = 0; j < nj; ++j) 
    505           for (i = 0; i < ni; ++i) 
    506           { 
    507             latvalue_temp(i+j*ni) = latvalue_2d(i,j); 
    508             if (hasBounds) 
    509             { 
    510               k=j*ni+i; 
    511               for(int n=0;n<nvertex;n++) bounds_lat_temp(n,k) = bounds_lat_2d(n,i,j); 
    512             } 
    513           } 
    514      } 
    515  
    516      if (!latvalue_1d.isEmpty()) 
    517      { 
    518        if (type_attr::rectilinear == type) 
    519        { 
    520  
    521          if (nj == latvalue_1d.numElements()) 
    522          { 
    523            for(j=0;j<nj;++j) 
    524              for(i=0;i<ni;++i) 
    525              { 
    526                k=j*ni+i; 
    527                latvalue_temp(k) = latvalue_1d(j); 
    528                if (hasBounds) 
    529                { 
    530                  for(int n=0;n<nvertex;n++) bounds_lat_temp(n,k) = bounds_lat_1d(n,j); 
    531                } 
    532              } 
    533           } 
    534           else 
    535             ERROR("CDomain::completeLonClient(void)", 
    536                  <<"The latvalue_1d has not the same size as the local domain"<<endl 
    537                  <<"Local size is "<<nj<<endl 
    538                  <<"Latvalue_1d size is "<<latvalue_1d.numElements()); 
    539        } 
    540        else if (type==type_attr::curvilinear || type==type_attr::unstructured) 
    541        { 
    542          latvalue_temp=latvalue_1d; 
    543          if (hasBounds) 
    544          { 
    545428           bounds_lat_temp=bounds_lat_1d; 
    546429         } 
     
    548431     } 
    549432 
    550      StdSize dm = zoom_ni_client * zoom_nj_client; 
     433    int i_ind,j_ind; 
     434    int global_zoom_iend=global_zoom_ibegin+global_zoom_ni-1; 
     435    int global_zoom_jend=global_zoom_jbegin+global_zoom_nj-1; 
     436 
     437    int globalIndexCountZoom = 0; 
     438    int nbIndex = i_index.numElements(); 
     439    for (i = 0; i < nbIndex; ++i) 
     440    { 
     441      i_ind=i_index(i); 
     442      j_ind=j_index(i); 
     443 
     444      if (i_ind >= global_zoom_ibegin && i_ind <= global_zoom_iend && j_ind >= global_zoom_jbegin && j_ind <= global_zoom_jend) 
     445      { 
     446        ++globalIndexCountZoom; 
     447      } 
     448    } 
    551449 
    552450      // Make sure that this attribute is non-empty for every client. 
    553      if (0 != dm) 
    554      { 
    555        latvalue_client.resize(dm); 
    556        if (hasBounds) bounds_lat_client.resize(nvertex,dm); 
    557      } 
    558  
    559      for (i = 0; i < zoom_ni_client; i++) 
    560      { 
    561        for (j = 0; j < zoom_nj_client; j++) 
     451     if (0 != globalIndexCountZoom) 
     452     { 
     453       lonvalue_client.resize(globalIndexCountZoom); 
     454       latvalue_client.resize(globalIndexCountZoom); 
     455       if (hasBounds) 
    562456       { 
    563          latvalue_client(i + j * zoom_ni_client) = latvalue_temp( (i + zoom_ibegin_client-ibegin) + (j + zoom_jbegin_client -jbegin)*ni ); 
     457         bounds_lon_client.resize(nvertex,globalIndexCountZoom); 
     458         bounds_lat_client.resize(nvertex,globalIndexCountZoom); 
     459       } 
     460     } 
     461 
     462     int nCountZoom = 0; 
     463     for (i = 0; i < nbIndex; ++i) 
     464     { 
     465       i_ind=i_index(i); 
     466       j_ind=j_index(i); 
     467 
     468       if (i_ind >= global_zoom_ibegin && i_ind <= global_zoom_iend && j_ind >= global_zoom_jbegin && j_ind <= global_zoom_jend) 
     469       { 
     470         lonvalue_client(nCountZoom) = lonvalue_temp(i); 
     471         latvalue_client(nCountZoom) = latvalue_temp(i); 
    564472         if (hasBounds) 
    565473         { 
    566            for(int n=0;n<nvertex;n++) 
     474           for (int n = 0; n < nvertex; ++n) 
    567475           { 
    568              bounds_lat_client(n,i + j * zoom_ni_client) = bounds_lat_temp( n, (i + zoom_ibegin_client - ibegin) + (j + zoom_jbegin_client -jbegin)*ni ); 
     476             bounds_lon_client(n,nCountZoom) = bounds_lon_temp(n,i); 
     477             bounds_lat_client(n,nCountZoom) = bounds_lat_temp(n,i); 
    569478           } 
    570479         } 
     480         ++nCountZoom; 
    571481       } 
    572482     } 
    573    } 
    574  
    575    //---------------------------------------------------------------- 
    576    void CDomain::completeLonLatClient(void) 
    577    { 
    578      completeLonClient(); 
    579      completeLatClient(); 
    580    } 
    581  
    582  
    583    //---------------------------------------------------------------- 
    584    void CDomain::checkZoom(void) 
    585    { 
    586       int global_zoom_iend=global_zoom_ibegin+global_zoom_ni-1 ; 
    587       zoom_ibegin_client = ibegin_client > global_zoom_ibegin ? ibegin_client : global_zoom_ibegin ; 
    588       zoom_iend_client = iend_client < global_zoom_iend ? iend_client : global_zoom_iend ; 
    589       zoom_ni_client=zoom_iend_client-zoom_ibegin_client+1 ; 
    590       if (zoom_ni_client<0) zoom_ni_client=0 ; 
    591  
    592  
    593       int global_zoom_jend=global_zoom_jbegin+global_zoom_nj-1 ; 
    594       zoom_jbegin_client = jbegin_client > global_zoom_jbegin ? jbegin_client : global_zoom_jbegin ; 
    595       zoom_jend_client = jend_client < global_zoom_jend ? jend_client : global_zoom_jend ; 
    596       zoom_nj_client=zoom_jend_client-zoom_jbegin_client+1 ; 
    597       if (zoom_nj_client<0) zoom_nj_client=0; 
    598483   } 
    599484 
     
    691576     hasLonLat = (!latvalue_1d.isEmpty() && !lonvalue_1d.isEmpty()) || 
    692577                 (!latvalue_2d.isEmpty() && !lonvalue_2d.isEmpty()); 
     578     if (hasLonLat) 
     579     { 
     580       if (!lonvalue_1d.isEmpty() && !lonvalue_2d.isEmpty()) 
     581         ERROR("CDomain::completeLonLatClient(void)", 
     582              <<"Only one longitude value can be used but both lonvalue_1d and lonvalue_2d are defined! "<<endl 
     583              <<"Define only one longitude value: lonvalue_1d or lonvalue_2d "); 
     584 
     585       if (!lonvalue_1d.isEmpty() && lonvalue_2d.isEmpty()) 
     586       { 
     587         if (lonvalue_1d.numElements() != i_index.numElements()) 
     588           ERROR("CDomain::completeLonLatClient(void)", 
     589                 <<"lonvalue_1d has not the same size as the local domain"<<endl 
     590                 <<"Local size is "<<i_index.numElements()<<endl 
     591                 <<"lonvalue_1d size is "<<lonvalue_1d.numElements()); 
     592       } 
     593 
     594       if (lonvalue_1d.isEmpty() && !lonvalue_2d.isEmpty()) 
     595       { 
     596          if ((lonvalue_2d.extent(0) != ni) || 
     597              (lonvalue_2d.extent(1) != nj)) 
     598             ERROR("CDomain::completeLonLatClient(void)", 
     599                   <<"the lonvalue has not the same size as the local domain"<<endl 
     600                   <<"Local size is "<<ni<<"x"<<nj<<endl 
     601                   <<"Lonvalue size is "<<lonvalue_2d.extent(0)<<"x"<<lonvalue_2d.extent(1)); 
     602       } 
     603 
     604       if (!latvalue_1d.isEmpty() && !latvalue_2d.isEmpty()) 
     605         ERROR("CDomain::completeLonLatClient(void)", 
     606              <<"Only one longitude value can be used but both latvalue_1d and latvalue_2d are defined! "<<endl 
     607              <<"Define only one longitude value: latvalue_1d or latvalue_2d "); 
     608 
     609       if (!latvalue_1d.isEmpty() && latvalue_2d.isEmpty()) 
     610       { 
     611         if (latvalue_1d.numElements() != i_index.numElements()) 
     612           ERROR("CDomain::completeLonLatClient(void)", 
     613                 <<"the latvalue_1d has not the same size as the local domain"<<endl 
     614                 <<"Local size is "<<i_index.numElements()<<endl 
     615                 <<"Mask size is "<<latvalue_1d.numElements()); 
     616       } 
     617 
     618       if (latvalue_1d.isEmpty() && !latvalue_2d.isEmpty()) 
     619       { 
     620          if ((latvalue_2d.extent(0) != ni) || 
     621              (latvalue_2d.extent(1) != nj)) 
     622             ERROR("CDomain::completeLonLatClient(void)", 
     623                   <<"the mask has not the same size as the local domain"<<endl 
     624                   <<"Local size is "<<ni<<"x"<<nj<<endl 
     625                   <<"Mask size is "<<latvalue_2d.extent(0)<<"x"<<latvalue_2d.extent(1)); 
     626       } 
     627     } 
    693628   } 
    694629 
     
    697632     CContext* context=CContext::getCurrent() ; 
    698633 
    699      this->checkZoom(); 
    700634     if (this->isClientAfterTransformationChecked) return; 
    701635     if (context->hasClient) 
     
    742676     CContext* context=CContext::getCurrent() ; 
    743677 
    744      this->checkZoom(); 
    745678     if (this->isChecked) return; 
    746679     if (context->hasClient) 
     
    759692 
    760693      this->checkDomain(); 
    761       this->checkZoom(); 
    762694      this->checkLonLat(); 
    763695      this->checkBounds(); 
     
    769701         this->checkDomainData(); 
    770702         this->checkCompression(); 
    771          this->completeLonLatClient(); 
     703 
    772704      } 
    773705      else 
     
    777709      if (context->hasClient) 
    778710      { 
    779         computeConnectedServer() ; 
    780         sendServerAttribut() ; 
    781         sendLonLatArea() ; 
     711        this->computeConnectedServer(); 
     712        this->completeLonLatClient(); 
     713        this->sendServerAttribut(); 
     714        this->sendLonLatArea(); 
    782715      } 
    783716 
     
    837770  void CDomain::computeConnectedServer(void) 
    838771  { 
    839     ibegin_client=ibegin; ni_client=ni; iend_client=ibegin_client + ni_client - 1; 
    840     jbegin_client=jbegin; nj_client=nj; jend_client=jbegin_client + nj_client - 1; 
    841  
    842772    CContext* context=CContext::getCurrent() ; 
    843773    CContextClient* client=context->client ; 
     
    846776 
    847777    int i,j,i_ind,j_ind, nbIndex; 
    848     int zoom_iend=global_zoom_ibegin+global_zoom_ni-1 ; 
    849     int zoom_jend=global_zoom_jbegin+global_zoom_nj-1 ; 
     778    int global_zoom_iend=global_zoom_ibegin+global_zoom_ni-1 ; 
     779    int global_zoom_jend=global_zoom_jbegin+global_zoom_nj-1 ; 
    850780 
    851781    // Precompute number of index 
     
    857787      j_ind=j_index(i); 
    858788 
    859       if (i_ind >= global_zoom_ibegin && i_ind <= zoom_iend && j_ind >= global_zoom_jbegin && j_ind <= zoom_jend) 
     789      if (i_ind >= global_zoom_ibegin && i_ind <= global_zoom_iend && j_ind >= global_zoom_jbegin && j_ind <= global_zoom_jend) 
    860790      { 
    861791        ++globalIndexCountZoom; 
     
    878808      globalIndexDomain(globalIndexCount) = globalIndex; 
    879809      ++globalIndexCount; 
    880       if (i_ind >= global_zoom_ibegin && i_ind <= zoom_iend && j_ind >= global_zoom_jbegin && j_ind <= zoom_jend) 
     810      if (i_ind >= global_zoom_ibegin && i_ind <= global_zoom_iend && j_ind >= global_zoom_jbegin && j_ind <= global_zoom_jend) 
    881811      { 
    882812        globalIndexDomainZoom(globalIndexCountZoom) = globalIndex; 
     
    10761006      { 
    10771007        idx = static_cast<int>(it->second[n]); 
    1078         i = i_index(idx); 
    1079         j = j_index(idx); 
    1080         ind = (i - zoom_ibegin_client) + (j - zoom_jbegin_client) * zoom_ni_client; 
    1081  
    1082         lon(n) = lonvalue_client(ind); 
    1083         lat(n) = latvalue_client(ind); 
     1008        lon(n) = lonvalue_client(idx); 
     1009        lat(n) = latvalue_client(idx); 
    10841010 
    10851011        if (hasBounds) 
     
    10881014          CArray<double,2>& boundslat = list_boundslat.back(); 
    10891015 
    1090           for (nv = 0; nv < nvertex; nv++) 
     1016          for (nv = 0; nv < nvertex; ++nv) 
    10911017          { 
    1092             boundslon(nv, n) = bounds_lon_client(nv, ind); 
    1093             boundslat(nv, n) = bounds_lat_client(nv, ind); 
     1018            boundslon(nv, n) = bounds_lon_client(nv, idx); 
     1019            boundslat(nv, n) = bounds_lat_client(nv, idx); 
    10941020          } 
    10951021        } 
     
    12521178      if (hasBounds) 
    12531179      { 
    1254         for (int nv = 0; nv < nvertex; nv++) 
     1180        for (int nv = 0; nv < nvertex; ++nv) 
    12551181          bounds_lon_srv(nv, ind_srv) = boundslon(nv, ind); 
    12561182      } 
  • XIOS/trunk/src/node/domain.hpp

    r665 r666  
    7777 
    7878      private : 
    79  
    8079         void checkDomain(void); 
    81  
    8280         void checkLocalIDomain(void); 
    8381         void checkLocalJDomain(void); 
     
    8785         void checkCompression(void); 
    8886 
    89          void checkZoom(void); 
    9087         void checkBounds(void); 
    9188         void checkArea(void); 
    9289         void checkLonLat(); 
    93  
    9490 
    9591      public : 
     
    107103 
    108104 
    109          int ni_client,ibegin_client,iend_client ; 
    110          int zoom_ni_client,zoom_ibegin_client,zoom_iend_client ; 
    111  
    112          int nj_client,jbegin_client,jend_client ; 
    113          int zoom_nj_client,zoom_jbegin_client,zoom_jend_client ; 
     105//         int ni_client,ibegin_client,iend_client ; 
     106//         int zoom_ni_client,zoom_ibegin_client,zoom_iend_client ; 
     107// 
     108//         int nj_client,jbegin_client,jend_client ; 
     109//         int zoom_nj_client,zoom_jbegin_client,zoom_jend_client ; 
    114110 
    115111         int ni_srv,ibegin_srv,iend_srv ; 
     
    133129 
    134130 
    135         CArray<int,2> mapConnectedServer ;  // (ni,nj) => mapped to connected server number, -1 if no server is target 
     131//        CArray<int,2> mapConnectedServer ;  // (ni,nj) => mapped to connected server number, -1 if no server is target 
    136132 
    137133        int global_zoom_ibegin, global_zoom_ni; 
    138134        int global_zoom_jbegin, global_zoom_nj; 
    139 //        CArray<bool,1> maskInter; 
    140135 
    141136      public : 
    142  
    143137         /// Mutateur /// 
    144138         void addRelFile(const StdString & filename); 
     
    178172         void setTransformations(const TransMapTypes&); 
    179173         void computeNGlobDomain(); 
    180          void completeLonClient(); 
    181          void completeLatClient(); 
    182174 
    183175         void sendIndex(); 
  • XIOS/trunk/src/node/grid.cpp

    r664 r666  
    686686      else 
    687687      { 
    688         globalDim_[idx] = axis[idxAxis]->size.getValue(); 
     688        globalDim_[idx] = axis[idxAxis]->n_glo.getValue(); 
    689689        ++idxAxis; 
    690690        ++idx; 
     
    807807            nZoomSize[indexMap[i]]  = axisList[axisId]->zoom_size_srv; 
    808808            nZoomBeginGlobal[indexMap[i]] = axisList[axisId]->global_zoom_begin; 
    809             nGlob[indexMap[i]] = axisList[axisId]->size; 
     809            nGlob[indexMap[i]] = axisList[axisId]->n_glo; 
    810810            ++axisId; 
    811811          } 
  • XIOS/trunk/src/node/zoom_axis.cpp

    r623 r666  
    2525  void CZoomAxis::checkValid(CAxis* axisDest) 
    2626  { 
    27     int axisIBegin, axisNi, axisSize; 
     27    int axisIBegin, axisNi, axisGlobalSize; 
    2828    int zoom_begin, zoom_end, zoom_size; 
    2929 
    30     axisIBegin = axisDest->ibegin.getValue(); 
    31     axisNi     = axisDest->ni.getValue(); 
    32     axisSize   = axisDest->size.getValue(); 
     30    axisIBegin = axisDest->begin.getValue(); 
     31    axisNi     = axisDest->n.getValue(); 
     32    axisGlobalSize   = axisDest->n_glo.getValue(); 
    3333 
    3434    zoom_begin = (this->zoom_begin.isEmpty()) ?  0 : this->zoom_begin.getValue() ; 
    35     zoom_size  = (this->zoom_size.isEmpty()) ?  axisSize : this->zoom_size.getValue() ; 
    36     zoom_end   = (this->zoom_end.isEmpty()) ?  (axisSize - 1) : this->zoom_end.getValue() ; 
     35    zoom_size  = (this->zoom_size.isEmpty()) ?  axisGlobalSize : this->zoom_size.getValue() ; 
     36    zoom_end   = (this->zoom_end.isEmpty()) ?  (axisGlobalSize - 1) : this->zoom_end.getValue() ; 
    3737 
    3838    if (this->zoom_begin.isEmpty()) zoom_begin=zoom_end-zoom_size+1; 
     
    4040    if (this->zoom_end.isEmpty()) zoom_end=zoom_begin+zoom_size-1; 
    4141 
    42     if ((zoom_begin < 0) || (zoom_begin > axisSize-1) || (zoom_end<0) || (zoom_end>axisSize-1) || (zoom_size<1) || (zoom_size>axisSize) || (zoom_begin>zoom_end)) 
     42    if ((zoom_begin < 0) || (zoom_begin > axisGlobalSize-1) || (zoom_end<0) || (zoom_end>axisGlobalSize-1) || (zoom_size<1) || (zoom_size>axisGlobalSize) || (zoom_begin>zoom_end)) 
    4343      ERROR("CZoomAxis::checkAttributes(void)", 
    4444            << "One or more attributes among <zoom_begin>, <zoom_end>, <zoom_size> of axis transformation [ id = '" << axisDest->getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] are not well specified"); 
Note: See TracChangeset for help on using the changeset viewer.