source: XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/gatherer_connector.cpp @ 1918

Last change on this file since 1918 was 1918, checked in by ymipsl, 4 years ago

Big update on on going work related to data distribution and transfer between clients and servers.

  • move all related file into distribution directorie
  • implement the concept of data "View"
  • implement the concept of "connector" which make the data transfer between 2 differents "Views"

YM

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.4 KB
Line 
1#include "gatherer_connector.hpp"
2
3namespace xios
4{
5  void CGathererConnector::computeConnector(void)
6  {
7    dstSize_=dstView_->getSize() ;
8    auto& srcGlobalIndex = srcView_->getGlobalIndex() ;
9    auto& srcIndex = srcView_->getIndex() ;
10    for(auto& rankIndex : srcIndex) srcSize_[rankIndex.first] = rankIndex.second.numElements();
11    auto& dstGlobalIndex = dstView_->getGlobalIndex() ;
12    auto& dstIndex = dstView_->getIndex() ;
13    dstSize_=dstIndex.numElements() ;
14
15    unordered_map<size_t,int> mapGlobalLocalIndex ;
16    int globalIndexSize=dstGlobalIndex.size() ;
17    for(auto& ind : dstIndex) mapGlobalLocalIndex[dstGlobalIndex(ind)] = ind ;
18    for(auto& rankIndex : srcIndex)
19    {
20      int rank=rankIndex.first ;
21      auto& index=rankIndex.second ;
22      int indexSize = index.numElements() ;
23      auto& globalIndex = srcGlobalIndex[rank] ;
24      int globalIndexSize=globalIndex.numElements() ;
25      auto& connector = connector_[rank] ;
26      auto& mask = mask_[rank] ;
27      for(int ind=0; ind<indexSize ; ind++)
28      {
29        if (ind>=0 && ind<globalIndexSize)
30        {
31           auto it=mapGlobalLocalIndex.find(globalIndex(ind)) ;
32           if (it != mapGlobalLocalIndex.end()) 
33           {
34             connector.push_back(it->second) ;
35             mask.push_back(true) ;
36           }
37           else mask.push_back(false) ;
38        }
39        else mask.push_back(false) ;
40      } 
41    } 
42  }
43
44 
45}
Note: See TracBrowser for help on using the repository browser.