Ignore:
Timestamp:
01/03/21 18:00:43 (3 years ago)
Author:
ymipsl
Message:

Adapt transformation algorithm to new infrastructure (on going...)

YM

Location:
XIOS/dev/dev_ym/XIOS_COUPLING/src/node
Files:
3 edited

Legend:

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

    r1988 r1999  
    850850        CGrid* newGrid ; 
    851851        std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = grid_->buildTransformationGraph(gc, true, nullptr, detectMissingValues, defaultValue, newGrid) ; 
     852        newGrid->duplicateAttributes(grid_) ; // for grid attributes (mask) 
    852853        grid_ = newGrid ; 
    853854        grid_ref=grid_->getId() ; // for server  
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp

    r1994 r1999  
    2727#include "grid_transformation_factory_impl.hpp" 
    2828#include "transform_filter.hpp" 
     29#include "grid_algorithm.hpp" 
    2930 
    3031 
     
    241242     for (int idx = 0; idx < order_.size(); ++idx) axis_domain_order(idx)=order_[idx]; 
    242243     CDomain* domain = vDomainGroup_->createChild(id); 
     244     isDomListSet=false ; 
    243245     computeElements(); 
    244246     return domain ; 
     
    253255     for (int idx = 0; idx < order_.size(); ++idx) axis_domain_order(idx)=order_[idx]; 
    254256     CAxis* axis=vAxisGroup_->createChild(id); 
     257     isAxisListSet=false ; 
    255258     computeElements();  
    256259     return axis ; 
     
    265268     for (int idx = 0; idx < order_.size(); ++idx) axis_domain_order(idx)=order_[idx]; 
    266269     CScalar* scalar =  vScalarGroup_->createChild(id); 
     270     isScalarListSet=false ; 
    267271     computeElements(); 
    268272     return scalar; 
     
    19221926    else   
    19231927    { 
    1924       newGrid = CGrid::create(newId) ; // give it an id later ?? 
     1928      newGrid = CGrid::create(newId) ; 
    19251929      isNewGrid = true ; 
    19261930    } 
     
    19301934    bool hasRemainTransform=false ; 
    19311935    CGenericAlgorithmTransformation* algo ; 
    1932     int dimBefore=1 ; 
    1933     int dimAfter=1 ; 
     1936    int pos ; 
    19341937 
    19351938    for(int i=0 ; i<elements_.size(); i++) 
     
    19581961      if (hasTransform && !hadTransform) 
    19591962      { 
     1963        pos=i ; 
    19601964        EElement dstElementType=transformationPath.getNextElementType() ; 
    19611965        string dstElementId=transformationPath.getNextElementId() ; 
     
    20752079          domain->checkAttributes() ; 
    20762080          
    2077           if (hadTransform) dimBefore*=domain->getLocalView(CElementView::WORKFLOW)->getLocalSize() ; 
    2078           else dimAfter*=domain->getLocalView(CElementView::WORKFLOW)->getLocalSize() ; 
    20792081          if (isNewGrid) newGrid->addDomain(srcElementId) ; 
    20802082        } 
     
    20912093          axis->checkAttributes() ; 
    20922094          
    2093           if (hadTransform) dimBefore*=axis->getLocalView(CElementView::WORKFLOW)->getLocalSize() ; 
    2094           else dimAfter*=axis->getLocalView(CElementView::WORKFLOW)->getLocalSize() ; 
    20952095          if (isNewGrid) newGrid->addAxis(srcElementId) ; 
    20962096        } 
     
    21072107          scalar->checkAttributes() ; 
    21082108          
    2109           if (hadTransform) dimBefore*=scalar->getLocalView(CElementView::WORKFLOW)->getLocalSize() ; 
    2110           else dimAfter*=scalar->getLocalView(CElementView::WORKFLOW)->getLocalSize() ; 
    21112109          if (isNewGrid) newGrid->addScalar(srcElementId) ; 
    21122110        } 
     
    21212119      if (!isSource) 
    21222120      { 
    2123         shared_ptr<CTransformFilter> transformFilter = shared_ptr<CTransformFilter>(new CTransformFilter(gc, algo, dimBefore, dimAfter, detectMissingValues, defaultValue)) ; 
     2121        CGridAlgorithm* gridAlgorithm  ; 
     2122        if (isNewGrid) 
     2123        {  
     2124          gridAlgorithm = algo->createGridAlgorithm(gridSrc, newGrid, pos) ; 
     2125          newGrid->setGridAlgorithm(gridAlgorithm); 
     2126        } 
     2127        else gridAlgorithm = newGrid->getGridAlgorithm() ; 
     2128 
     2129        shared_ptr<CTransformFilter> transformFilter = shared_ptr<CTransformFilter>(new CTransformFilter(gc, gridAlgorithm, detectMissingValues, defaultValue)) ; 
    21242130        outputFilter->connectOutput(transformFilter,0) ; 
    21252131        outputFilter = transformFilter ; 
     
    21292135      { 
    21302136        gridSrc=newGrid ; 
    2131         pair<shared_ptr<CFilter>, shared_ptr<CFilter> > filters = gridSrc->buildTransformationGraph(gc, isSource, gridSrc, detectMissingValues, defaultValue, newGrid) ; 
     2137        pair<shared_ptr<CFilter>, shared_ptr<CFilter> > filters = this->buildTransformationGraph(gc, isSource, gridSrc, detectMissingValues, defaultValue, newGrid) ; 
    21322138        outputFilter->connectOutput(filters.first,0) ; 
    21332139        outputFilter=filters.second ; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.hpp

    r1988 r1999  
    2222#include "transformation_path.hpp" 
    2323#include "filter.hpp" 
     24#include "grid_algorithm.hpp" 
    2425 
    2526 
     
    239240                                                                                  double defaultValue, CGrid*& newGrid) ; 
    240241      private: 
     242        CGridAlgorithm* gridAlgorithm_ = nullptr ; 
     243      public: 
     244        void setGridAlgorithm(CGridAlgorithm* gridAlgorithm) {gridAlgorithm_ = gridAlgorithm;} 
     245        CGridAlgorithm* getGridAlgorithm(void) { return gridAlgorithm_ ;} 
     246      private: 
    241247         bool isTransformed_, isGenerated_; 
    242248         CGridTransformation* transformations_; 
Note: See TracChangeset for help on using the changeset viewer.