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/domain.cpp

    r743 r747  
    18441844 
    18451845  /*! 
    1846     A current domain will go up the hierarchy to find out the domain from which it has transformation 
    1847   */ 
     1846   * Go through the hierarchy to find the domain from which the transformations must be inherited 
     1847   */ 
    18481848  void CDomain::solveInheritanceTransformation() 
    18491849  { 
    1850     if (this->hasTransformation()) return; 
    1851  
    1852     std::vector<CDomain*> refDomain; 
    1853     CDomain* refer_sptr; 
    1854     CDomain* refer_ptr = this; 
    1855     while (refer_ptr->hasDirectDomainReference()) 
    1856     { 
    1857       refDomain.push_back(refer_ptr); 
    1858       refer_sptr = refer_ptr->getDirectDomainReference(); 
    1859       refer_ptr  = refer_sptr; 
    1860       if (refer_ptr->hasTransformation()) break; 
    1861     } 
    1862  
    1863     if (refer_ptr->hasTransformation()) 
    1864       for (int idx = 0; idx < refDomain.size(); ++idx) 
    1865         refDomain[idx]->setTransformations(refer_ptr->getAllTransformations()); 
     1850    if (hasTransformation() || !hasDirectDomainReference()) 
     1851      return; 
     1852 
     1853    CDomain* domain = this; 
     1854    std::vector<CDomain*> refDomains; 
     1855    while (!domain->hasTransformation() && domain->hasDirectDomainReference()) 
     1856    { 
     1857      refDomains.push_back(domain); 
     1858      domain = domain->getDirectDomainReference(); 
     1859    } 
     1860 
     1861    if (domain->hasTransformation()) 
     1862      for (size_t i = 0; i < refDomains.size(); ++i) 
     1863        refDomains[i]->setTransformations(domain->getAllTransformations()); 
     1864 
     1865    // Try to inherit the id of the referenced object as the domain name 
     1866    // when no name was been defined and a defaut id is used. 
     1867    if (name.isEmpty()) 
     1868    { 
     1869      static const std::string defId("__domain_undef_id_"); 
     1870      const std::string& id = getId(); 
     1871      if (id.size() > defId.size() && id.compare(0, defId.size(), defId) == 0) 
     1872        name = domain->getId(); 
     1873    } 
    18661874  } 
    18671875 
Note: See TracChangeset for help on using the changeset viewer.