1 | #include "local_view.hpp" |
---|
2 | #include "element.hpp" |
---|
3 | #include "array_new.hpp" |
---|
4 | #include "remote_connector.hpp" |
---|
5 | |
---|
6 | namespace 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 | CLocalView::CLocalView(CLocalElement* parent, CElementView::type type, const CArray<bool,1>& maskView) |
---|
18 | : CDistributedView( parent, type, {{ parent->localRank_, maskView }} ), |
---|
19 | localRank_(parent->localRank_), |
---|
20 | globalIndex_(parent->globalIndex_), size_(CDistributedView::size_[parent->localRank_]), |
---|
21 | index_(CDistributedView::index_[parent->localRank_]), localSize_(CDistributedView::localSize_[parent->localRank_]) |
---|
22 | { |
---|
23 | |
---|
24 | } |
---|
25 | |
---|
26 | void CLocalView::sendRemoteElement(CRemoteConnector& connector, CContextClient* client, CEventClient& event, const CMessage& messageHeader) |
---|
27 | { |
---|
28 | int n = index_.numElements() ; |
---|
29 | int nglo=globalIndex_.numElements() ; |
---|
30 | CArray<size_t,1> ind(n) ; |
---|
31 | for(int i=0; i<n;i++) |
---|
32 | { |
---|
33 | if (index_(i)>=0 && index_(i)<nglo) ind(i) = globalIndex_(index_(i)) ; |
---|
34 | else ind(i)=index_(i) ; |
---|
35 | } |
---|
36 | CMessage message(messageHeader) ; |
---|
37 | message<<globalSize_ ; |
---|
38 | connector.transferToServer(ind, client, event, message) ; |
---|
39 | } |
---|
40 | |
---|
41 | |
---|
42 | } |
---|