Gather data from a pool according to an index mapping. Automatically resize the memory when necessary. */
| 192 | |
| 193 | /** Gather data from a pool according to an index mapping. Automatically resize the memory when necessary. */ |
| 194 | void gather(const std::vector<Data> &memory, const std::vector<Index> &mapping) { |
| 195 | if (!mapping.empty()) { |
| 196 | resize(mapping.size()); |
| 197 | for (Index i = 0; i < count; i++) |
| 198 | host_ptr[i] = memory[mapping[i]]; |
| 199 | } |
| 200 | else { |
| 201 | resize(memory.size()); |
| 202 | for (Index i = 0; i < count; i++) |
| 203 | host_ptr[i] = memory[i]; |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | /** Scatter data to a pool according to an index mapping */ |
| 208 | void scatter(std::vector<Data> &memory, const std::vector<Index> &mapping) { |
no outgoing calls
no test coverage detected