Ignore:
Timestamp:
02/01/22 15:28:48 (2 years ago)
Author:
ymipsl
Message:

Improve reduction transformation

  • make the difference between reduction over geometry or reduction between process.
  • geometrical reduction :

domain -> axis
axis -> scalar
domain -> scalar

  • reduction across processes for redondant geometrical cell :

axis -> axis
scalar -> scalar

Reduction can be local (only for the geometrical cell owned by current process) or global, using the "local" attribute (bool) over the reduction.

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm/axis_algorithm_reduce_axis.cpp

    r2270 r2291  
    1212#include "grid.hpp" 
    1313#include "grid_transformation_factory_impl.hpp" 
     14#include "grid_algorithm_reduce.hpp" 
    1415 
    1516 
     
    5051TRY 
    5152{ 
    52   eliminateRedondantSrc_= false ; 
     53  if (!axisDestination->checkGeometricAttributes(false)) 
     54  { 
     55    axisDestination->resetGeometricAttributes(); 
     56    axisDestination->setGeometricAttributes(*axisSource) ; 
     57  } 
     58  axisDestination->checkAttributes() ;  
    5359  algo->checkValid(axisDestination, axisSource); 
    54   axisDestination->checkAttributes() ; 
     60   
    5561 
    5662  switch (algo->operation) 
     
    7581  } 
    7682 
    77   TransformationIndexMap& transMap = this->transformationMapping_; 
    78   CArray<int,1>& axisDstIndex = axisDestination->index; 
    79   int nbAxisIdx = axisDstIndex.numElements(); 
    80   for (int idxAxis = 0; idxAxis < nbAxisIdx; ++idxAxis) 
     83  //TransformationIndexMap& transMap = this->transformationMapping_; 
     84  //CArray<int,1>& axisDstIndex = axisDestination->index; 
     85  //int nbAxisIdx = axisDstIndex.numElements(); 
     86 
     87 
     88 
     89  auto& transMap = this->transformationMapping_; 
     90   
     91  CArray<size_t,1> dstGlobalIndex ; 
     92  axisDestination->getLocalView(CElementView::WORKFLOW)->getGlobalIndexView(dstGlobalIndex) ; 
     93  size_t nbIdx = dstGlobalIndex.numElements(); 
     94 
     95  for (size_t idx = 0; idx < nbIdx; ++idx) 
    8196  { 
    82     int globalAxisIdx = axisDstIndex(idxAxis); 
    83     transMap[globalAxisIdx].resize(1); 
    84     transMap[globalAxisIdx][0]=globalAxisIdx ;       
     97    size_t globalIdx = dstGlobalIndex(idx); 
     98    transMap[globalIdx].resize(1); 
     99    transMap[globalIdx][0]=globalIdx ;       
    85100  } 
    86101 
    87   
    88   axisDestination->checkAttributes() ; 
    89102  this->computeAlgorithm(axisSource->getLocalView(CElementView::WORKFLOW), axisDestination->getLocalView(CElementView::WORKFLOW)) ; 
    90103} 
    91104CATCH 
    92105 
     106shared_ptr<CGridAlgorithm> CAxisAlgorithmReduceAxis::createGridAlgorithm(CGrid* gridSrc, CGrid* gridDst, int pos) 
     107{ 
     108  auto algo=make_shared<CGridAlgorithmReduce>(gridSrc, gridDst, pos, shared_from_this(), operator_) ; 
     109  algo->computeAlgorithm(false) ; 
     110  return algo ;  
     111} 
    93112 
    94113CAxisAlgorithmReduceAxis::~CAxisAlgorithmReduceAxis() 
Note: See TracChangeset for help on using the changeset viewer.