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

    r2267 r2291  
    114114  *         some redondant ranks can be removed from the elements_ map. 
    115115  */ 
    116   void CGridRemoteConnector::computeConnector(void) 
    117   { 
    118     computeViewDistribution() ; 
    119     computeConnectorMethods() ; 
    120     computeRedondantRanks() ;  
    121     for(auto& rank : rankToRemove_) 
    122       for(auto& element : elements_) element.erase(rank) ; 
    123   } 
     116  void CGridRemoteConnector::computeConnector(bool eliminateRedundant) 
     117  { 
     118    if (eliminateRedundant) 
     119    { 
     120      computeViewDistribution() ; 
     121      computeConnectorMethods() ; 
     122      computeRedondantRanks() ;  
     123      for(auto& rank : rankToRemove_) 
     124        for(auto& element : elements_) element.erase(rank) ; 
     125    } 
     126    else 
     127    { 
     128       computeViewDistribution() ; 
     129       computeConnectorRedundant() ; 
     130    } 
     131  } 
     132 
     133/** 
     134  * \brief Compute the connector, i.e. compute the \b elements_ attribute.  
     135  * \detail In this routine we don't eliminate redundant cells as it it performed in  
     136  *         computeConnectorMethods. It can be usefull to perform reduce operation over processes. 
     137            In future, some optimisation could be done considering full redondance of the  
     138            source view or the destination view. 
     139  */ 
     140  void CGridRemoteConnector::computeConnectorRedundant(void) 
     141  { 
     142    vector<shared_ptr<CLocalView>> srcView ; 
     143    vector<shared_ptr<CDistributedView>> dstView ; 
     144    vector<int> indElements ; 
     145    elements_.resize(srcView_.size()) ; 
     146     
     147    bool srcViewsNonDistributed=true ; // not usefull now but later for optimization 
     148    for(int i=0;i<srcView_.size();i++) srcViewsNonDistributed = srcViewsNonDistributed && !isSrcViewDistributed_[i]  ; 
     149     
     150    bool dstViewsNonDistributed=true ;  // not usefull now but later for optimization 
     151    for(int i=0;i<dstView_.size();i++) dstViewsNonDistributed = dstViewsNonDistributed && !isDstViewDistributed_[i] ; 
     152     
     153    for(int i=0;i<srcView_.size();i++)  
     154    { 
     155      srcView.push_back(srcView_[i]) ; 
     156      dstView.push_back(dstView_[i]) ; 
     157      indElements.push_back(i) ; 
     158    } 
     159 
     160    computeGenericMethod(srcView, dstView, indElements) ; 
     161     
     162    map<int,bool> ranks ;   
     163    for(auto& it : elements_[indElements[0]])  
     164    { 
     165      if (it.second.numElements()==0) ranks[it.first] = false ; 
     166      else  ranks[it.first] = true ; 
     167    } 
     168    
     169  } 
     170 
     171 
    124172/** 
    125173  * \brief Compute the connector, i.e. compute the \b elements_ attribute.  
     
    426474  } 
    427475 
    428    
     476 
    429477 /** 
    430478  * \brief Generic method the compute the grid remote connector. Only distributed elements are specifed in the source view and remote view.  
     
    650698    } 
    651699  } 
    652  
     700   
    653701} 
Note: See TracChangeset for help on using the changeset viewer.