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/scalar_algorithm/scalar_algorithm_reduce_scalar.cpp

    r2270 r2291  
    1010#include "grid_transformation_factory_impl.hpp" 
    1111#include "reduction.hpp" 
     12#include "grid_algorithm_reduce.hpp" 
     13 
    1214 
    1315 
     
    4749TRY 
    4850{ 
    49   eliminateRedondantSrc_= false ; 
     51  scalarDestination->checkAttributes() ; 
    5052  if (algo->operation.isEmpty()) 
    5153    ERROR("CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(CScalar* scalarDestination, CScalar* scalarSource, CReduceScalarToScalar* algo)", 
     
    7577 
    7678  } 
    77   transformationMapping_[0].push_back(0) ; 
     79   
     80  auto& transMap = this->transformationMapping_; 
     81   
     82  CArray<size_t,1> dstGlobalIndex ; 
     83  scalarDestination->getLocalView(CElementView::WORKFLOW)->getGlobalIndexView(dstGlobalIndex) ; 
     84  size_t nbIdx = dstGlobalIndex.numElements(); 
    7885 
    79   scalarDestination->checkAttributes() ; 
     86  for (size_t idx = 0; idx < nbIdx; ++idx) 
     87  { 
     88    size_t globalIdx = dstGlobalIndex(idx); 
     89    transMap[globalIdx].resize(1); 
     90    transMap[globalIdx][0]=globalIdx ;       
     91  } 
     92 
    8093  this->computeAlgorithm(scalarSource->getLocalView(CElementView::WORKFLOW), scalarDestination->getLocalView(CElementView::WORKFLOW)) ;  
    8194} 
    8295CATCH 
     96 
     97shared_ptr<CGridAlgorithm> CScalarAlgorithmReduceScalar::createGridAlgorithm(CGrid* gridSrc, CGrid* gridDst, int pos) 
     98{ 
     99  auto algo=make_shared<CGridAlgorithmReduce>(gridSrc, gridDst, pos, shared_from_this(), operator_) ; 
     100  algo->computeAlgorithm(false) ; 
     101  return algo ;  
     102} 
    83103 
    84104CScalarAlgorithmReduceScalar::~CScalarAlgorithmReduceScalar() 
Note: See TracChangeset for help on using the changeset viewer.