1 | #include "gatherer_connector.hpp" |
---|
2 | |
---|
3 | namespace xios |
---|
4 | { |
---|
5 | void CGathererConnector::computeConnector(void) |
---|
6 | { |
---|
7 | dstSize_=dstView_->getSize() ; |
---|
8 | auto& srcGlobalIndex = srcView_->getGlobalIndex() ; |
---|
9 | auto& srcIndex = srcView_->getIndex() ; |
---|
10 | for(auto& rankIndex : srcIndex) srcSize_[rankIndex.first] = rankIndex.second.numElements(); |
---|
11 | auto& dstGlobalIndex = dstView_->getGlobalIndex() ; |
---|
12 | auto& dstIndex = dstView_->getIndex() ; |
---|
13 | dstSize_=dstIndex.numElements() ; |
---|
14 | |
---|
15 | unordered_map<size_t,int> mapGlobalLocalIndex ; |
---|
16 | int globalIndexSize=dstGlobalIndex.size() ; |
---|
17 | for(auto& ind : dstIndex) mapGlobalLocalIndex[dstGlobalIndex(ind)] = ind ; |
---|
18 | for(auto& rankIndex : srcIndex) |
---|
19 | { |
---|
20 | int rank=rankIndex.first ; |
---|
21 | auto& index=rankIndex.second ; |
---|
22 | int indexSize = index.numElements() ; |
---|
23 | auto& globalIndex = srcGlobalIndex[rank] ; |
---|
24 | int globalIndexSize=globalIndex.numElements() ; |
---|
25 | auto& connector = connector_[rank] ; |
---|
26 | auto& mask = mask_[rank] ; |
---|
27 | for(int ind=0; ind<indexSize ; ind++) |
---|
28 | { |
---|
29 | if (ind>=0 && ind<globalIndexSize) |
---|
30 | { |
---|
31 | auto it=mapGlobalLocalIndex.find(globalIndex(ind)) ; |
---|
32 | if (it != mapGlobalLocalIndex.end()) |
---|
33 | { |
---|
34 | connector.push_back(it->second) ; |
---|
35 | mask.push_back(true) ; |
---|
36 | } |
---|
37 | else mask.push_back(false) ; |
---|
38 | } |
---|
39 | else mask.push_back(false) ; |
---|
40 | } |
---|
41 | } |
---|
42 | } |
---|
43 | |
---|
44 | |
---|
45 | } |
---|