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/distribution/grid_transform_connector.hpp

    r2267 r2291  
    88#include "grid_scatterer_connector.hpp" 
    99#include "grid_gatherer_connector.hpp" 
     10#include "reduction_types.hpp" 
    1011#include "mpi.hpp" 
    1112 
     
    2021      CGridTransformConnector(vector<shared_ptr<CLocalView>> srcViews, vector<shared_ptr<CLocalView>> remoteViews, MPI_Comm localComm)  
    2122                          : srcViews_(srcViews), remoteViews_(remoteViews), localComm_(localComm)  
    22                           { computeConnector();} 
     23                          { } 
    2324     
    24       void computeConnector(void) ;  
     25      void computeConnector(bool eliminateRedundant=true) ;  
    2526    protected: 
    2627     MPI_Comm localComm_ ; 
     
    3637    public: 
    3738      template<typename T>  
    38       void transfer(const CArray<T,1>& dataIn, CArray<T,1>& dataOut) 
     39      void transfer(const CArray<T,1>& dataIn, CArray<T,1>& dataOut, EReduction op = EReduction::none) 
    3940      { 
    4041        map<int,CArray<T,1>> tmpArrayIn ; 
     
    6263         
    6364        const double nanValue = std::numeric_limits<double>::quiet_NaN(); 
    64         gridGathererConnector_->transfer(tmpArrayOut, dataOut, nanValue) ; 
     65 
     66        if (op == EReduction::none) gridGathererConnector_->transfer(tmpArrayOut, dataOut, nanValue) ; 
     67        else gridGathererConnector_->transfer(tmpArrayOut, dataOut, op) ; 
    6568      } 
    6669   
Note: See TracChangeset for help on using the changeset viewer.