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_axis.cpp

    r2270 r2291  
    7979 
    8080  }  
     81 
     82  bool local=false ; 
     83  if (!algo->local.isEmpty()) local=algo->local ; 
    8184   
    82   int globalIndexSize = axisSource-> n_glo; 
    83   for (int idx = 0; idx < globalIndexSize; ++idx)  transformationMapping_[0].push_back(idx); 
     85  auto& transMap = this->transformationMapping_;   
     86   
     87  if (local) 
     88  { 
     89    scalarDestination->n=1 ; // no mask 
     90    scalarDestination->mask.reset() ; 
     91     
     92    CArray<size_t,1> srcGlobalIndex ; 
     93    axisSource->getLocalView(CElementView::WORKFLOW)->getGlobalIndexView(srcGlobalIndex) ; 
     94    size_t nbIdx = srcGlobalIndex.numElements(); 
     95    if (nbIdx==0) scalarDestination->n=0 ; 
     96    scalarDestination->checkAttributes() ; 
    8497 
    85   scalarDestination->checkAttributes() ; 
     98    for (size_t idx = 0; idx < nbIdx; ++idx) 
     99    { 
     100      size_t globalIdx = srcGlobalIndex(idx); 
     101      transformationMapping_[0].push_back(globalIdx); 
     102    } 
     103 
     104  } 
     105  else 
     106  { 
     107   scalarDestination->checkAttributes() ; 
     108 
     109   int globalIndexSize = axisSource->getLocalView(CElementView::WORKFLOW)->getGlobalSize(); 
     110   CArray<size_t,1> dstGlobalIndex ; 
     111   scalarDestination->getLocalView(CElementView::WORKFLOW)->getGlobalIndexView(dstGlobalIndex) ; 
     112   if (dstGlobalIndex.numElements()!=0) 
     113     for (int idx = 0; idx < globalIndexSize; ++idx)  transformationMapping_[0].push_back(idx); 
     114  } 
     115 
    86116  this->computeAlgorithm(axisSource->getLocalView(CElementView::WORKFLOW), scalarDestination->getLocalView(CElementView::WORKFLOW)) ; 
    87117   
Note: See TracChangeset for help on using the changeset viewer.