Changeset 770 for XIOS/trunk/src/node


Ignore:
Timestamp:
10/30/15 16:33:48 (9 years ago)
Author:
rlacroix
Message:

Field: Handle more correctly the output name for the fields with a field_ref.

If the field has an explicitly defined name (which might be inherited) then it is used as the output name.
If no name was defined but an id was set, the id is used as the output name.
If no name was defined and the id was automatically generated, the id of the field directly referenced is used as the output name.

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

Legend:

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

    r767 r770  
    760760      { 
    761761        ERROR("CField::solveGridReference(void)", 
    762               << "A grid must be defined for field '" << (!name.isEmpty() ? name.getValue() : getId()) << "' ."); 
     762              << "A grid must be defined for field '" << getFieldOutputName() << "' ."); 
    763763      } 
    764764      else if (!grid_ref.isEmpty() && (!domain_ref.isEmpty() || !axis_ref.isEmpty())) 
    765765      { 
    766766        ERROR("CField::solveGridReference(void)", 
    767               << "Field '" << (!name.isEmpty() ? name.getValue() : getId()) << "' has both a grid and a domain/axis." << std::endl 
     767              << "Field '" << getFieldOutputName() << "' has both a grid and a domain/axis." << std::endl 
    768768              << "Please define either 'grid_ref' or 'domain_ref'/'axis_ref'."); 
    769769      } 
  • XIOS/trunk/src/node/file.cpp

    r757 r770  
    956956   void CFile::sendEnabledFields() 
    957957   { 
    958      int size = this->enabledFields.size(); 
    959      CField* fieldPtr(0); 
    960      for (int i = 0; i < size; ++i) 
     958     size_t size = this->enabledFields.size(); 
     959     for (size_t i = 0; i < size; ++i) 
    961960     { 
    962        fieldPtr = this->enabledFields[i]; 
    963        if (fieldPtr->name.isEmpty()) fieldPtr->name.setValue(fieldPtr->getBaseFieldReference()->getId()); 
    964        this->sendAddField(fieldPtr->getId()); 
    965        fieldPtr->sendAllAttributesToServer(); 
    966        fieldPtr->sendAddAllVariables(); 
     961       CField* field = this->enabledFields[i]; 
     962       this->sendAddField(field->getId()); 
     963       field->sendAllAttributesToServer(); 
     964       field->sendAddAllVariables(); 
    967965     } 
    968966   } 
Note: See TracChangeset for help on using the changeset viewer.