source: XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/local_view.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.2 KB
Line 
1#include "local_view.hpp"
2#include "element.hpp"
3#include "array_new.hpp"
4#include "remote_connector.hpp"
5
6namespace xios
7{
8  CLocalView::CLocalView(CLocalElement* parent, CElementView::type type, const CArray<int,1>& indexView) 
9                        : CDistributedView( parent, type, {{  parent->localRank_,  indexView }} ),
10                          localRank_(parent->localRank_),
11                          globalIndex_(parent->globalIndex_), size_(CDistributedView::size_[parent->localRank_]),
12                          index_(CDistributedView::index_[parent->localRank_]), localSize_(CDistributedView::localSize_[parent->localRank_]) 
13  {
14
15  }
16
17
18  void CLocalView::sendRemoteElement(CRemoteConnector& connector, CContextClient* client, CEventClient& event, const CMessage& messageHeader)
19  {
20    int n = index_.numElements() ;
21    int nglo=globalIndex_.numElements() ;
22    CArray<size_t,1> ind(n) ;
23    for(int i=0; i<n;i++)
24    {
25      if (index_(i)>=0 && index_(i)<nglo) ind(i) = globalIndex_(index_(i)) ;
26      else ind(i)=index_(i) ;
27    }
28    CMessage message(messageHeader) ;
29    message<<globalSize_ ;
30    connector.transferToServer(ind, client, event, message) ;
31  }
32
33
34}
Note: See TracBrowser for help on using the repository browser.