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

File:
1 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; 
Note: See TracChangeset for help on using the changeset viewer.