source: XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/local_view.hpp @ 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:executable set to *
File size: 1.5 KB
Line 
1#ifndef __LOCAL_VIEW_HPP__
2#define __LOCAL_VIEW_HPP__
3
4#include "xios_spl.hpp"
5#include "array_new.hpp"
6#include "distributed_view.hpp"
7#include "context_client.hpp"
8
9namespace xios
10{
11
12  class CLocalElement ;
13  class CRemoteConnector ;
14
15  class CLocalView : public CDistributedView
16  {
17    public:
18    CLocalView(CLocalElement* parent, CElementView::type type, const CArray<int,1>& indexView) ;
19    const CArray<int,1>& getIndex(void) { return index_ ;}
20    const CArray<size_t,1>& getGlobalIndex(void) { return globalIndex_ ;}
21
22    void getGlobalIndex(vector<size_t>& globalIndex, size_t sliceIndex, size_t* sliceSize, CLocalView** localView, int pos)
23    {
24      if (pos==0)
25      {
26        for(int i=0;i<size_;i++)
27          if (index_(i)>=0 && index_(i)<localSize_) globalIndex.push_back(sliceIndex + globalIndex_(index_(i))) ;
28      }
29      else 
30      {
31        for(int i=0;i<size_;i++)
32          if (index_(i)>=0 && index_(i)<localSize_) 
33            localView[pos-1]->getGlobalIndex(globalIndex, sliceIndex + globalIndex_(index_(i))*sliceSize[pos], sliceSize, localView, pos-1) ;
34      }
35    }
36
37
38    int getLocalSize(void) {return localSize_ ;}
39    int getSize(void) {return size_;} 
40    void sendRemoteElement(CRemoteConnector& connector, CContextClient* client, CEventClient& event, const CMessage& messageHeader) ;
41   
42    CArray<size_t,1>& globalIndex_ ;
43    CArray<int,1>& index_ ;
44    int& size_ ;
45    int& localRank_ ;
46    int& localSize_ ;
47  } ;
48
49}
50
51#endif
Note: See TracBrowser for help on using the repository browser.