Ignore:
Timestamp:
10/21/15 11:50:11 (9 years ago)
Author:
rlacroix
Message:

Fix the inherited name for axis/domains with reference in some cases.

Correctly account for transformations and non default ids.

File:
1 edited

Legend:

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

    r742 r747  
    872872  } 
    873873 
     874  /*! 
     875   * Go through the hierarchy to find the axis from which the transformations must be inherited 
     876   */ 
    874877  void CAxis::solveInheritanceTransformation() 
    875878  { 
    876     if (this->hasTransformation()) return; 
    877  
     879    if (hasTransformation() || !hasDirectAxisReference()) 
     880      return; 
     881 
     882    CAxis* axis = this; 
    878883    std::vector<CAxis*> refAxis; 
    879     CAxis* refer_sptr; 
    880     CAxis* refer_ptr = this; 
    881     while (refer_ptr->hasDirectAxisReference()) 
    882     { 
    883       refAxis.push_back(refer_ptr); 
    884       refer_sptr = refer_ptr->getDirectAxisReference(); 
    885       refer_ptr  = refer_sptr; 
    886       if (refer_ptr->hasTransformation()) break; 
    887     } 
    888  
    889     if (refer_ptr->hasTransformation()) 
    890       for (int idx = 0; idx < refAxis.size(); ++idx) 
    891         refAxis[idx]->setTransformations(refer_ptr->getAllTransformations()); 
     884    while (!axis->hasTransformation() && axis->hasDirectAxisReference()) 
     885    { 
     886      refAxis.push_back(axis); 
     887      axis = axis->getDirectAxisReference(); 
     888    } 
     889 
     890    if (axis->hasTransformation()) 
     891      for (size_t i = 0; i < refAxis.size(); ++i) 
     892        refAxis[i]->setTransformations(axis->getAllTransformations()); 
     893 
     894    // Try to inherit the id of the referenced object as the axis name 
     895    // when no name was been defined and a defaut id is used. 
     896    if (name.isEmpty()) 
     897    { 
     898      static const std::string defId("__axis_undef_id_"); 
     899      const std::string& id = getId(); 
     900      if (id.size() > defId.size() && id.compare(0, defId.size(), defId) == 0) 
     901        name = axis->getId(); 
     902    } 
    892903  } 
    893904 
Note: See TracChangeset for help on using the changeset viewer.