Changeset 566


Ignore:
Timestamp:
03/09/15 10:04:51 (6 years ago)
Author:
rlacroix
Message:

Improve the error messages when checking the axis attributes.

Location:
XIOS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • XIOS/branchs/xios-1.0/src/node/axis.cpp

    r501 r566  
    99 
    1010namespace xios { 
    11     
     11 
    1212   /// ////////////////////// Définitions ////////////////////// /// 
    1313 
     
    5454      if (this->isChecked) return; 
    5555      if (this->size.isEmpty()) 
    56          ERROR("CAxis::checkAttributes(void)",<< "Attribut <size> of the axis must be specified") ; 
     56         ERROR("CAxis::checkAttributes(void)", 
     57               << "Attribute <size> of the axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] must be specified"); 
    5758      StdSize size = this->size.getValue(); 
    58        
    59       StdSize zoom_begin,zoom_end, zoom_size ; 
    60        
    61       zoom_begin = (this->zoom_begin.isEmpty()) ?  1 : this->zoom_begin.getValue() ; 
    62       zoom_end = (this->zoom_end.isEmpty()) ?  size : this->zoom_end.getValue() ;  
    63       zoom_size = (this->zoom_size.isEmpty()) ?  size : this->zoom_size.getValue() ; 
    64        
    65       if (this->zoom_begin.isEmpty()) zoom_begin=zoom_end-zoom_size+1 ; 
    66       if (this->zoom_end.isEmpty()) zoom_end=zoom_begin+zoom_size-1 ; 
    67       if (this->zoom_size.isEmpty()) zoom_size=zoom_end-zoom_begin+1 ; 
    68        
     59 
     60      StdSize zoom_begin,zoom_end, zoom_size; 
     61 
     62      zoom_begin = (this->zoom_begin.isEmpty()) ?  1 : this->zoom_begin.getValue(); 
     63      zoom_end = (this->zoom_end.isEmpty()) ?  size : this->zoom_end.getValue(); 
     64      zoom_size = (this->zoom_size.isEmpty()) ?  size : this->zoom_size.getValue(); 
     65 
     66      if (this->zoom_begin.isEmpty()) zoom_begin=zoom_end-zoom_size+1; 
     67      if (this->zoom_end.isEmpty()) zoom_end=zoom_begin+zoom_size-1; 
     68      if (this->zoom_size.isEmpty()) zoom_size=zoom_end-zoom_begin+1; 
     69 
    6970      if ( (zoom_begin < 1) || (zoom_begin > size) || (zoom_end<1) || (zoom_end>size) || (zoom_size<1) || (zoom_size>size) || (zoom_begin>zoom_end)) 
    70         ERROR("CAxis::checkAttributes(void)",<< "One or more attribut of <zoom_begin>, <zoom_end>, <zoom_size>, are not well specified") ; 
    71       this->zoom_begin.setValue(zoom_begin) ; 
    72       this->zoom_end.setValue(zoom_end) ; 
    73       this->zoom_size.setValue(zoom_size) ; 
    74        
     71        ERROR("CAxis::checkAttributes(void)", 
     72              << "One or more attributes among <zoom_begin>, <zoom_end>, <zoom_size> of axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] are not well specified"); 
     73      this->zoom_begin.setValue(zoom_begin); 
     74      this->zoom_end.setValue(zoom_end); 
     75      this->zoom_size.setValue(zoom_size); 
     76 
    7577      StdSize true_size = value.numElements(); 
    7678      if (size != true_size) 
    7779         ERROR("CAxis::checkAttributes(void)", 
    78                << "The array \'value\' has a different size that the one defined by the \'size\' attribut") 
     80               << "The array \'value\' of axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] has a different size that the one defined by the \'size\' attribute"); 
    7981 
    8082      this->isChecked = true; 
  • XIOS/trunk/src/node/axis.cpp

    r553 r566  
    5454      if (this->isChecked) return; 
    5555      if (this->size.isEmpty()) 
    56          ERROR("CAxis::checkAttributes(void)",<< "Attribut <size> of the axis must be specified") ; 
     56         ERROR("CAxis::checkAttributes(void)", 
     57               << "Attribute <size> of the axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] must be specified"); 
    5758      StdSize size = this->size.getValue(); 
    5859 
     
    6162        StdSize ibegin = this->ibegin.getValue(); 
    6263        if ((ibegin < 0) || (ibegin > size-1)) 
    63           ERROR("CAxis::checkAttributes(void)",<< "Attribut <ibegin> of the axis must be non-negative and smaller than size-1") ; 
     64          ERROR("CAxis::checkAttributes(void)", 
     65                << "Attribute <ibegin> of the axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] must be non-negative and smaller than size-1"); 
    6466      } 
    6567      else this->ibegin.setValue(0); 
     
    6971        StdSize ni = this->ni.getValue(); 
    7072        if ((ni < 0) || (ni > size)) 
    71           ERROR("CAxis::checkAttributes(void)",<< "Attribut <ni> of the axis must be non-negative and smaller than size") ; 
     73          ERROR("CAxis::checkAttributes(void)", 
     74                << "Attribute <ni> of the axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] must be non-negative and smaller than size"); 
    7275      } 
    7376      else this->ni.setValue(size); 
    7477 
    75       StdSize zoom_begin,zoom_end, zoom_size ; 
     78      StdSize zoom_begin,zoom_end, zoom_size; 
    7679 
    7780      // Maybe index begins at 0 (zero) 
    78       zoom_begin = (this->zoom_begin.isEmpty()) ?  0 : this->zoom_begin.getValue() ; 
    79       zoom_end = (this->zoom_end.isEmpty()) ?  size-1 : this->zoom_end.getValue() ; 
    80       zoom_size = (this->zoom_size.isEmpty()) ?  size : this->zoom_size.getValue() ; 
     81      zoom_begin = (this->zoom_begin.isEmpty()) ?  0 : this->zoom_begin.getValue(); 
     82      zoom_end = (this->zoom_end.isEmpty()) ?  size-1 : this->zoom_end.getValue(); 
     83      zoom_size = (this->zoom_size.isEmpty()) ?  size : this->zoom_size.getValue(); 
    8184 
    82       if (this->zoom_begin.isEmpty()) zoom_begin=zoom_end-zoom_size+1 ; 
    83       if (this->zoom_end.isEmpty()) zoom_end=zoom_begin+zoom_size-1 ; 
    84       if (this->zoom_size.isEmpty()) zoom_size=zoom_end-zoom_begin+1 ; 
     85      if (this->zoom_begin.isEmpty()) zoom_begin=zoom_end-zoom_size+1; 
     86      if (this->zoom_end.isEmpty()) zoom_end=zoom_begin+zoom_size-1; 
     87      if (this->zoom_size.isEmpty()) zoom_size=zoom_end-zoom_begin+1; 
    8588 
    8689      if ( (zoom_begin < 0) || (zoom_begin > size-1) || (zoom_end<0) || (zoom_end>size-1) || (zoom_size<1) || (zoom_size>size) || (zoom_begin>zoom_end)) 
    87         ERROR("CAxis::checkAttributes(void)",<< "One or more attribut of <zoom_begin>, <zoom_end>, <zoom_size>, are not well specified") ; 
     90        ERROR("CAxis::checkAttributes(void)", 
     91              << "One or more attributes among <zoom_begin>, <zoom_end>, <zoom_size> of axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] are not well specified"); 
    8892 
    89       this->zoom_begin.setValue(zoom_begin) ; 
    90       this->zoom_end.setValue(zoom_end) ; 
    91       this->zoom_size.setValue(zoom_size) ; 
     93      this->zoom_begin.setValue(zoom_begin); 
     94      this->zoom_end.setValue(zoom_end); 
     95      this->zoom_size.setValue(zoom_size); 
    9296 
    9397      StdSize true_size = value.numElements(); 
    9498      if (size != true_size) 
    9599         ERROR("CAxis::checkAttributes(void)", 
    96                << "The array \'value\' has a different size that the one defined by the \'size\' attribut") 
     100               << "The array \'value\' of axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] has a different size that the one defined by the \'size\' attribute"); 
    97101 
    98102      this->checkData(); 
     
    107111      { 
    108112        ERROR("CAxis::checkData(void)", 
    109               << "Data dimension is negative (data_n).") ; 
     113              << "Data dimension is negative (data_n)."); 
    110114      } 
    111115      else if (data_n.isEmpty()) 
     
    152156      { // Si aucun masque n'est défini, 
    153157        // on en crée un nouveau qui valide l'intégralité du domaine. 
    154          mask.resize(ni) ; 
     158         mask.resize(ni); 
    155159         for (int i = 0; i < ni.getValue(); ++i) 
    156160         { 
Note: See TracChangeset for help on using the changeset viewer.