| 136 |  |  | 
| 137 |  | int nCommProcs = myComm.Get_size(); | 
| 138 |  |  | 
| 139 | < | counts.reserve(nCommProcs); | 
| 140 | < | displacements.reserve(nCommProcs); | 
| 139 | > | counts.resize(nCommProcs, 0); | 
| 140 | > | displacements.resize(nCommProcs, 0); | 
| 141 |  |  | 
| 142 |  | planSize_ = MPITraits<T>::Length() * nObjects; | 
| 143 |  |  | 
| 156 |  |  | 
| 157 |  |  | 
| 158 |  | void gather(vector<T>& v1, vector<T>& v2) { | 
| 159 | + |  | 
| 160 | + | // an assert would be helpful here to make sure the vectors are the | 
| 161 | + | // correct geometry | 
| 162 | + |  | 
| 163 |  | myComm.Allgatherv(&v1[0], | 
| 164 |  | planSize_, | 
| 165 |  | MPITraits<T>::Type(), | 
| 172 |  |  | 
| 173 |  |  | 
| 174 |  | void scatter(vector<T>& v1, vector<T>& v2) { | 
| 175 | + | // an assert would be helpful here to make sure the vectors are the | 
| 176 | + | // correct geometry | 
| 177 |  |  | 
| 178 |  | myComm.Reduce_scatter(&v1[0], &v2[0], &counts[0], | 
| 179 |  | MPITraits<T>::Type(), MPI::SUM); |