Ignore:
Timestamp:
01/26/16 18:19:04 (8 years ago)
Author:
mhnguyen
Message:

Changing value of axis from obligatory to optional attribute

Test
+) On Curie
+) Test passes

File:
1 edited

Legend:

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

    r815 r816  
    2626      , isDistributed_(false), hasBounds_(false), isCompressible_(false) 
    2727      , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 
    28       , transformationMap_(), global_zoom_begin(0), global_zoom_size(0) 
     28      , transformationMap_(), global_zoom_begin(0), global_zoom_size(0), hasValue(false) 
    2929   { 
    3030   } 
     
    3535      , isDistributed_(false), hasBounds_(false), isCompressible_(false) 
    3636      , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 
    37       , transformationMap_(), global_zoom_begin(0), global_zoom_size(0) 
     37      , transformationMap_(), global_zoom_begin(0), global_zoom_size(0), hasValue(false) 
    3838   { 
    3939   } 
     
    220220      else this->n.setValue(size); 
    221221 
    222       StdSize true_size = value.numElements(); 
    223       if (this->n.getValue() != true_size) 
    224         ERROR("CAxis::checkAttributes(void)", 
    225               << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " 
    226               << "The axis is wrongly defined, attribute 'value' has a different size (" << true_size << ") than the one defined by the \'size\' attribute (" << n.getValue() << ")."); 
     222      if (!this->value.isEmpty()) 
     223      { 
     224        StdSize true_size = value.numElements(); 
     225        if (this->n.getValue() != true_size) 
     226          ERROR("CAxis::checkAttributes(void)", 
     227                << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " 
     228                << "The axis is wrongly defined, attribute 'value' has a different size (" << true_size << ") than the one defined by the \'size\' attribute (" << n.getValue() << ")."); 
     229        this->hasValue = true; 
     230      } 
     231 
     232//      StdSize true_size = value.numElements(); 
     233//      if (this->n.getValue() != true_size) 
     234//        ERROR("CAxis::checkAttributes(void)", 
     235//              << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " 
     236//              << "The axis is wrongly defined, attribute 'value' has a different size (" << true_size << ") than the one defined by the \'size\' attribute (" << n.getValue() << ")."); 
    227237 
    228238      this->checkData(); 
     
    351361     { 
    352362       sendServerAttribut(globalDim, orderPositionInGrid, distType); 
    353        sendValue(globalDim, orderPositionInGrid, distType); 
     363       if (hasValue) sendValue(globalDim, orderPositionInGrid, distType); 
    354364     } 
    355365 
     
    864874      zoom_size_srv  = zoom_end_srv - zoom_begin_srv + 1; 
    865875    } 
    866     value_srv.resize(zoom_size_srv); 
    867     bound_srv.resize(2,zoom_size_srv); 
     876    if (hasValue) 
     877    { 
     878      value_srv.resize(zoom_size_srv); 
     879      if (hasBounds_)  bound_srv.resize(2,zoom_size_srv); 
     880    } 
    868881  } 
    869882 
Note: See TracChangeset for help on using the changeset viewer.