Changeset 1990


Ignore:
Timestamp:
12/14/20 12:58:39 (9 months ago)
Author:
ymipsl
Message:

New tranformation :

  • reuse generated grid which are common between fields

--> assign a unique id to each generated grid

  • recursive call supressed if no remaining transformation in the grid.

YM

File:
1 edited

Legend:

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

    r1988 r1990  
    19111911    std::shared_ptr<CFilter> outputFilter = inputFilter ; 
    19121912     
    1913     newGrid = CGrid::create() ; // give it an id later ?? 
     1913    string newId ; 
     1914    if (gridSrc!=nullptr) newId = gridSrc->getId() + " --> " + this->getId()  ; 
     1915    else newId = " --> " + this->getId()  ; 
     1916    bool isNewGrid ; 
     1917    if (CGrid::has(newId)) 
     1918    { 
     1919      newGrid = CGrid::get(newId); 
     1920      isNewGrid = false ; 
     1921    } 
     1922    else   
     1923    { 
     1924      newGrid = CGrid::create(newId) ; // give it an id later ?? 
     1925      isNewGrid = true ; 
     1926    } 
     1927 
    19141928    bool hadTransform=false ; 
    19151929    bool hasTransform=false ; 
     1930    bool hasRemainTransform=false ; 
    19161931    CGenericAlgorithmTransformation* algo ; 
    19171932    int dimBefore=1 ; 
     
    19411956      hasTransform=transformationPath.hasTransform()  ; 
    19421957       
     1958      if (hasTransform && hadTransform) hasRemainTransform=true ; 
    19431959 
    19441960      if (hasTransform && !hadTransform) 
     
    19831999            dstDomain->setTransformationPaths(transformationPath) ; 
    19842000          } 
    1985           newGrid->addDomain(dstDomain->getId()) ; 
     2001          if (isNewGrid) newGrid->addDomain(dstDomain->getId()) ; 
    19862002          algo = dstDomain->getTransformationAlgorithm() ; 
    19872003        } 
     
    20102026            dstAxis->setTransformationPaths(transformationPath) ; 
    20112027          } 
    2012           newGrid->addAxis(dstAxis->getId()) ; 
     2028           if (isNewGrid) newGrid->addAxis(dstAxis->getId()) ; 
    20132029          algo = dstAxis->getTransformationAlgorithm() ; 
    20142030        } 
     
    20372053            dstScalar->setTransformationPaths(transformationPath) ; 
    20382054          } 
    2039           newGrid->addScalar(dstScalar->getId()) ; 
     2055           if (isNewGrid) newGrid->addScalar(dstScalar->getId()) ; 
    20402056          algo = dstScalar->getTransformationAlgorithm() ;           
    20412057        } 
     
    20612077          if (hadTransform) dimBefore*=domain->getLocalView(CElementView::WORKFLOW)->getLocalSize() ; 
    20622078          else dimAfter*=domain->getLocalView(CElementView::WORKFLOW)->getLocalSize() ; 
    2063           newGrid->addDomain(srcElementId) ; 
     2079          if (isNewGrid) newGrid->addDomain(srcElementId) ; 
    20642080        } 
    20652081        else if (srcElement.type==TYPE_AXIS) 
     
    20762092          if (hadTransform) dimBefore*=axis->getLocalView(CElementView::WORKFLOW)->getLocalSize() ; 
    20772093          else dimAfter*=axis->getLocalView(CElementView::WORKFLOW)->getLocalSize() ; 
    2078           newGrid->addAxis(srcElementId) ; 
     2094          if (isNewGrid) newGrid->addAxis(srcElementId) ; 
    20792095        } 
    20802096        else if (srcElement.type==TYPE_SCALAR) 
     
    20912107          if (hadTransform) dimBefore*=scalar->getLocalView(CElementView::WORKFLOW)->getLocalSize() ; 
    20922108          else dimAfter*=scalar->getLocalView(CElementView::WORKFLOW)->getLocalSize() ; 
    2093           newGrid->addScalar(srcElementId) ; 
     2109          if (isNewGrid) newGrid->addScalar(srcElementId) ; 
    20942110        } 
    20952111      } 
     
    21052121      } 
    21062122 
    2107       gridSrc=newGrid ; 
    2108       pair<shared_ptr<CFilter>, shared_ptr<CFilter> > filters = gridSrc->buildTransformationGraph(gc, isSource, gridSrc, detectMissingValues, defaultValue, newGrid) ; 
    2109       outputFilter->connectOutput(filters.first,0) ; 
    2110       outputFilter=filters.second ; 
     2123      if (hasRemainTransform) 
     2124      { 
     2125        gridSrc=newGrid ; 
     2126        pair<shared_ptr<CFilter>, shared_ptr<CFilter> > filters = gridSrc->buildTransformationGraph(gc, isSource, gridSrc, detectMissingValues, defaultValue, newGrid) ; 
     2127        outputFilter->connectOutput(filters.first,0) ; 
     2128        outputFilter=filters.second ; 
     2129      } 
    21112130    } 
    21122131      
Note: See TracChangeset for help on using the changeset viewer.