source: XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/local_connector.cpp @ 1960

Last change on this file since 1960 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.1 KB
Line 
1#include "local_connector.hpp"
2
3
4namespace xios
5{
6    void CLocalConnector::computeConnector(void)
7  {
8    int srcLocalSize=srcView_->getLocalSize() ;
9    const CArray<int,1>& srcIndex = srcView_->getIndex() ;
10    int srcSize = srcIndex.numElements() ;
11
12    int dstLocalSize=dstView_->getLocalSize() ;
13    const CArray<int,1>& dstIndex = dstView_->getIndex() ;
14    int dstSize = dstIndex.numElements() ;
15
16    CArray<int,1> local(srcLocalSize) ;
17    local = -1 ;
18    mask_.resize(dstSize) ;
19
20    for(int i=0;i<srcSize;i++)
21    {
22      if (srcIndex(i)>=0 && srcIndex(i) < srcLocalSize) local(srcIndex(i)) = i ;
23    }
24
25    int connectorSize=0 ;
26    for(int i=0;i<dstSize;i++)
27    {
28      if (dstIndex(i)>=0 && dstIndex(i) < dstLocalSize && local(dstIndex(i))!=-1)
29      { 
30        mask_[i]=true ;
31        connectorSize++ ;
32      }
33      else mask_[i]=false ;
34    }
35   
36    connector_.resize(connectorSize) ;
37    connectorSize=0 ;
38    for(int i=0;i<dstSize;i++)
39    {
40      if (mask_[i])
41      {
42        connector_[connectorSize] = local(dstIndex(i)) ;
43        connectorSize++ ;
44      }
45    }
46  }
47
48
49
50}
Note: See TracBrowser for help on using the repository browser.