Changeset 2011 for XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution
- Timestamp:
- 01/12/21 23:05:02 (3 years ago)
- Location:
- XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/gatherer_connector.hpp
r1995 r2011 110 110 } 111 111 112 // hook for transfering mask in grid connector, maybe find an other way to doing that... 113 void transfer_or(int rank, CGathererConnector** connectors, int nConnectors, const bool* input, bool* output) 114 { 115 auto& connector = connector_[rank] ; // probably costly, find a better way to avoid the map 116 auto& mask = mask_[rank] ; 117 int srcSize = mask.size() ; 118 119 if (nConnectors==0) 120 { 121 for(int i=0, j=0; i<srcSize; i++) 122 if (mask[i]) 123 { 124 *(output+connector[j]) |= *(input + i) ; 125 j++ ; 126 } 127 128 } 129 else 130 { 131 int srcSliceSize = (*(connectors-1))->getSrcSliceSize(rank, connectors-1, nConnectors-1) ; 132 int dstSliceSize = (*(connectors-1))->getDstSliceSize(connectors-1, nConnectors-1) ; 133 134 const bool* in = input ; 135 for(int i=0,j=0;i<srcSize;i++) 136 { 137 if (mask[i]) 138 { 139 (*(connectors-1))->transfer_or(rank, connectors-1, nConnectors-1, in, output+connector[j]*dstSliceSize) ; // the multiplication must be avoid in further optimization 140 j++ ; 141 } 142 in += srcSliceSize ; 143 } 144 } 145 146 } 147 148 112 149 113 150 template<typename T> -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_gatherer_connector.hpp
r1943 r2011 65 65 transfer(dataIn, dataOut) ; 66 66 } 67 67 68 69 void transfer_or(CEventServer& event, CArray<bool,1>& dataOut) 70 { 71 map<int, CArray<bool,1>> dataIn ; 72 for (auto& subEvent : event.subEvents) 73 { 74 auto& data = dataIn[subEvent.rank]; 75 (*subEvent.buffer) >> data ; 76 } 77 transfer_or(dataIn, dataOut) ; 78 } 79 68 80 template<typename T> 69 81 void transfer(CEventServer& event, CArray<T,1>& dataOut, T missingValue) … … 78 90 } 79 91 92 void transfer_or(const map<int, CArray<bool,1>>& input, CArray<bool,1>& output) 93 { 94 int n = elementsConnector_.size()-1 ; 95 CGathererConnector** connector = elementsConnector_.data() + n ; 96 output.resize(dstSize_) ; 97 output = false ; 98 for(auto& rankDataIn : input) 99 { 100 elementsConnector_[n]->transfer_or(rankDataIn.first, connector, n, rankDataIn.second.dataFirst(), output.dataFirst()) ; 101 } 102 } 103 80 104 }; 81 105 }
Note: See TracChangeset
for help on using the changeset viewer.