Changeset 2351


Ignore:
Timestamp:
07/06/22 15:29:52 (23 months ago)
Author:
ymipsl
Message:
  • Solve inheritance problem when referenced field is not on the same grid that current field and no transformation is involved (grid casting).
  • Solve name inheritance problem for axis, domain or scalar elements in ouput files. Now name is determided folowing id or names of inherited element if current id is automatically generated.

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp

    r2343 r2351  
    19511951    if (CGrid::has(newId)) 
    19521952    { 
    1953       cout<<"Retrive existing grid : "<<newId<<endl ; 
     1953      info(100)<<"Retrive existing grid : "<<newId<<endl ; 
    19541954      newGrid = CGrid::get(newId); 
    19551955      isNewGrid = false ; 
     
    19571957    else   
    19581958    { 
    1959       cout<<"Create new grid : "<<newId<<endl ; 
     1959      info(100)<<"Create new grid : "<<newId<<endl ; 
    19601960      newGrid = CGrid::create(newId) ; 
    19611961      isNewGrid = true ; 
     
    19781978 
    19791979      SElement srcElement  ; 
    1980       if (gridSrc==nullptr) srcElement = this->elements_[i] ; 
    1981       else srcElement = gridSrc->elements_[i] ; 
    1982  
    1983       if (gridSrc==nullptr) transformationPath.mergePaths() ; 
     1980       
     1981      CTransformationPaths testTransformationPath(transformationPath) ; 
     1982      testTransformationPath.mergePaths() ; 
     1983 
     1984      if (testTransformationPath.hasTransform()) 
     1985      {   
     1986        if (gridSrc==nullptr) srcElement = this->elements_[i] ; 
     1987        else srcElement = gridSrc->elements_[i] ; 
     1988 
     1989        if (gridSrc==nullptr) transformationPath.mergePaths() ; 
     1990        else 
     1991        {   
     1992          if (srcElement.type==TYPE_DOMAIN)      transformationPath.mergePaths(srcElement.domain->getTransformationPaths()) ; 
     1993          else if (srcElement.type==TYPE_AXIS)   transformationPath.mergePaths(srcElement.axis->getTransformationPaths()) ; 
     1994          else if (srcElement.type==TYPE_SCALAR) transformationPath.mergePaths(srcElement.scalar->getTransformationPaths()) ; 
     1995        } 
     1996      } 
    19841997      else 
    1985       {   
    1986         if (srcElement.type==TYPE_DOMAIN)      transformationPath.mergePaths(srcElement.domain->getTransformationPaths()) ; 
    1987         else if (srcElement.type==TYPE_AXIS)   transformationPath.mergePaths(srcElement.axis->getTransformationPaths()) ; 
    1988         else if (srcElement.type==TYPE_SCALAR) transformationPath.mergePaths(srcElement.scalar->getTransformationPaths()) ; 
    1989       } 
     1998      { 
     1999        srcElement = this->elements_[i] ; 
     2000        transformationPath.mergePaths() ; 
     2001      }   
    19902002 
    19912003      hasTransform=transformationPath.hasTransform()  ; 
     
    20092021        map<int,int> posInGrid={{0,0}} ; 
    20102022                
    2011         cout<<"--> New transform from "<<srcElementId<<" to "<<dstElementId<<endl ; 
     2023        info(100)<<"--> New transform from "<<srcElementId<<" to "<<dstElementId<<endl ; 
    20122024        if (dstElementType==EElement::DOMAIN) 
    20132025        { 
     
    20222034            { 
    20232035              dstDomain = CDomain::get(dstElementId) ; 
    2024               cout<<"Retrive existing domain : "<<dstElementId<<endl ; 
     2036              info(100)<<"Retrive existing domain : "<<dstElementId<<endl ; 
    20252037            } 
    20262038            else 
     
    20282040              dstDomain = CDomain::create() ; 
    20292041              dstDomain->createAlias(dstElementId) ; 
    2030               cout<<"Create new domain : "<<dstDomain->getId()<<" with alias : "<<dstElementId<<endl ; 
     2042              info(100)<<"Create new domain : "<<dstDomain->getId()<<" with alias : "<<dstElementId<<endl ; 
    20312043 
    20322044              if (isGenerate)  
     
    20842096            { 
    20852097              dstAxis = CAxis::get(dstElementId) ; 
    2086               cout<<"Retrive existing axis : "<<dstElementId<<endl ; 
     2098              info(100)<<"Retrive existing axis : "<<dstElementId<<endl ; 
    20872099            } 
    20882100            else 
     
    20902102              dstAxis = CAxis::create() ; 
    20912103              dstAxis->createAlias(dstElementId) ; 
    2092               cout<<"Create new axis : "<<dstAxis->getId()<<" with alias : "<<dstElementId<<endl ; 
     2104              info(100)<<"Create new axis : "<<dstAxis->getId()<<" with alias : "<<dstElementId<<endl ; 
    20932105               
    20942106              if (isGenerate)  
     
    21452157            { 
    21462158              dstScalar = CScalar::get(dstElementId) ; 
    2147               cout<<"Retrive existing scalar : "<<dstElementId<<endl ; 
     2159              info(100)<<"Retrive existing scalar : "<<dstElementId<<endl ; 
    21482160            } 
    21492161            else 
     
    21512163              dstScalar = CScalar::create() ; 
    21522164              dstScalar->createAlias(dstElementId) ; 
    2153               cout<<"Create new scalar : "<<dstScalar->getId()<<" with alias : "<<dstElementId<<endl ; 
     2165              info(100)<<"Create new scalar : "<<dstScalar->getId()<<" with alias : "<<dstElementId<<endl ; 
    21542166               
    21552167              if (isGenerate)  
     
    23232335          domain->duplicateAttributes(element.domain) ; 
    23242336          domain->setTemplateId(element.domain) ; 
    2325           if (domain->name.isEmpty()) domain->name = element.domain->getId() ; 
     2337          domain->name = domain->getDomainOutputName() ; 
    23262338          newGrid->addDomain(domain->getId()) ; 
    23272339        } 
     
    23312343          axis->duplicateAttributes(element.axis) ; 
    23322344          axis->setTemplateId(element.axis) ; 
    2333           if (axis->name.isEmpty()) axis->name = element.axis->getId() ; 
     2345          axis->name = axis->getAxisOutputName() ; 
    23342346          newGrid->addAxis(axis->getId()) ; 
    23352347        } 
     
    23392351          scalar->duplicateAttributes(element.scalar) ; 
    23402352          scalar->setTemplateId(element.scalar) ; 
    2341           if (scalar->name.isEmpty()) scalar->name = element.scalar->getId() ; 
     2353          scalar->name = scalar->getScalarOutputName() ; 
    23422354          newGrid->addScalar(scalar->getId()) ; 
    23432355        } 
Note: See TracChangeset for help on using the changeset viewer.