[1918] | 1 | #include "local_view.hpp" |
---|
| 2 | #include "element.hpp" |
---|
| 3 | #include "array_new.hpp" |
---|
| 4 | #include "remote_connector.hpp" |
---|
| 5 | |
---|
| 6 | namespace xios |
---|
| 7 | { |
---|
[2267] | 8 | CLocalView::CLocalView(shared_ptr<CLocalElement> parent, CElementView::type type, const CArray<int,1>& indexView) |
---|
[1918] | 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 | |
---|
[2267] | 17 | CLocalView::CLocalView(shared_ptr<CLocalElement> parent, CElementView::type type, const CArray<bool,1>& maskView) |
---|
[1930] | 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 | { |
---|
[1918] | 23 | |
---|
[1930] | 24 | } |
---|
| 25 | |
---|
[2267] | 26 | void CLocalView::sendRemoteElement(shared_ptr<CRemoteConnector> connector, CContextClient* client, CEventClient& event, const CMessage& messageHeader) |
---|
[1918] | 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_ ; |
---|
[2267] | 38 | connector->transferToServer(ind, client, event, message) ; |
---|
[1918] | 39 | } |
---|
| 40 | |
---|
| 41 | |
---|
| 42 | } |
---|